home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 27 code / Speech_Recognition_Sample.sit / Speech Recognition Sample / SRSample.c next >
MacBinary  |  1996-06-19  |  23.5 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Jun 19 11:40:05 1996, modified Wed Jun 19 11:40:05 1996, creator 'CWIE', type ASCII, 23306 bytes "SRSample.c" , at 0x5b8a 456 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0a 53 52 53 61 6d 70 | 6c 65 2e 63 00 00 00 00 |..SRSamp|le.c....|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 5b 0a 00 | 00 01 c8 ad ed cf d5 ad |.....[..|........|
|00000060| ed cf d5 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 5f a0 00 00 |........|...._...|
|00000080| 2f 2a 0d 09 46 69 6c 65 | 3a 09 09 53 52 53 61 6d |/*..File|:..SRSam|
|00000090| 70 6c 65 2e 63 0d 0d 09 | 43 6f 6e 74 61 69 6e 73 |ple.c...|Contains|
|000000a0| 3a 09 53 61 6d 70 6c 65 | 20 63 6f 64 65 20 69 6c |:.Sample| code il|
|000000b0| 6c 75 73 74 72 61 74 69 | 6e 67 20 62 61 73 69 63 |lustrati|ng basic|
|000000c0| 20 75 73 65 20 6f 66 20 | 74 68 65 0d 09 09 09 09 | use of |the.....|
|000000d0| 53 70 65 65 63 68 20 52 | 65 63 6f 67 6e 69 74 69 |Speech R|ecogniti|
|000000e0| 6f 6e 20 4d 61 6e 61 67 | 65 72 2e 0d 09 0d 09 57 |on Manag|er.....W|
|000000f0| 72 69 74 74 65 6e 20 62 | 79 3a 09 41 72 6c 6f 20 |ritten b|y:.Arlo |
|00000100| 52 65 65 76 65 73 20 26 | 20 4d 61 74 74 20 50 61 |Reeves &| Matt Pa|
|00000110| 6c 6c 61 6b 6f 66 66 2c | 20 41 70 70 6c 65 20 43 |llakoff,| Apple C|
|00000120| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 2a 2f |omputer,| Inc..*/|
|00000130| 0d 0d 23 69 6e 63 6c 75 | 64 65 20 22 53 70 65 65 |..#inclu|de "Spee|
|00000140| 63 68 52 65 63 6f 67 6e | 69 74 69 6f 6e 2e 68 22 |chRecogn|ition.h"|
|00000150| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 54 79 70 65 73 |.#includ|e <Types|
|00000160| 2e 68 3e 0d 23 69 6e 63 | 6c 75 64 65 20 3c 4d 65 |.h>.#inc|lude <Me|
|00000170| 6d 6f 72 79 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |mory.h>.|#include|
|00000180| 20 3c 51 75 69 63 6b 64 | 72 61 77 2e 68 3e 0d 23 | <Quickd|raw.h>.#|
|00000190| 69 6e 63 6c 75 64 65 20 | 3c 54 65 78 74 45 64 69 |include |<TextEdi|
|000001a0| 74 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 44 |t.h>.#in|clude <D|
|000001b0| 69 61 6c 6f 67 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |ialogs.h|>.#inclu|
|000001c0| 64 65 20 3c 4f 53 55 74 | 69 6c 73 2e 68 3e 0d 23 |de <OSUt|ils.h>.#|
|000001d0| 69 6e 63 6c 75 64 65 20 | 3c 54 6f 6f 6c 55 74 69 |include |<ToolUti|
|000001e0| 6c 73 2e 68 3e 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ls.h>.#i|nclude <|
|000001f0| 4d 65 6e 75 73 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |Menus.h>|.#includ|
|00000200| 65 20 3c 46 6f 6e 74 73 | 2e 68 3e 0d 23 69 6e 63 |e <Fonts|.h>.#inc|
|00000210| 6c 75 64 65 20 3c 45 76 | 65 6e 74 73 2e 68 3e 0d |lude <Ev|ents.h>.|
|00000220| 23 69 6e 63 6c 75 64 65 | 20 3c 52 65 73 6f 75 72 |#include| <Resour|
|00000230| 63 65 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |ces.h>.#|include |
|00000240| 3c 46 69 6c 65 73 2e 68 | 3e 0d 23 69 6e 63 6c 75 |<Files.h|>.#inclu|
|00000250| 64 65 20 3c 45 72 72 6f | 72 73 2e 68 3e 0d 23 69 |de <Erro|rs.h>.#i|
|00000260| 6e 63 6c 75 64 65 20 3c | 41 70 70 6c 65 45 76 65 |nclude <|AppleEve|
|00000270| 6e 74 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |nts.h>.#|include |
|00000280| 3c 47 65 73 74 61 6c 74 | 2e 68 3e 0d 23 69 6e 63 |<Gestalt|.h>.#inc|
|00000290| 6c 75 64 65 20 3c 73 74 | 72 69 6e 67 2e 68 3e 0d |lude <st|ring.h>.|
|000002a0| 0d 2f 2a 20 27 44 49 54 | 4c 27 20 49 44 27 73 20 |./* 'DIT|L' ID's |
|000002b0| 66 6f 72 20 6d 61 69 6e | 20 64 69 61 6c 6f 67 20 |for main| dialog |
|000002c0| 2a 2f 0d 0d 65 6e 75 6d | 20 7b 0d 09 6b 51 75 69 |*/..enum| {..kQui|
|000002d0| 74 42 75 74 74 6f 6e 20 | 3d 20 31 2c 0d 09 6b 57 |tButton |= 1,..kW|
|000002e0| 68 61 74 59 6f 75 43 61 | 6e 53 61 79 53 74 54 78 |hatYouCa|nSayStTx|
|000002f0| 2c 0d 09 6b 47 72 61 6d | 6d 61 72 53 74 54 78 2c |,..kGram|marStTx,|
|00000300| 0d 09 6b 57 68 61 74 57 | 61 73 48 65 61 72 64 53 |..kWhatW|asHeardS|
|00000310| 74 54 78 2c 0d 09 6b 52 | 65 73 75 6c 74 54 65 78 |tTx,..kR|esultTex|
|00000320| 74 53 74 54 78 0d 7d 3b | 0d 0d 2f 2a 20 63 6f 6e |tStTx.};|../* con|
|00000330| 73 74 61 6e 74 73 20 2a | 2f 0d 0d 65 6e 75 6d 20 |stants *|/..enum |
|00000340| 7b 0d 09 6b 44 69 61 6c | 6f 67 52 65 73 49 44 20 |{..kDial|ogResID |
|00000350| 09 09 09 09 3d 09 31 32 | 38 2c 0d 0d 09 6b 54 6f |....=.12|8,...kTo|
|00000360| 70 4c 4d 52 65 66 63 6f | 6e 09 09 09 09 3d 09 31 |pLMRefco|n....=.1|
|00000370| 30 30 2c 0d 09 6b 48 65 | 6c 6c 6f 52 65 66 43 6f |00,..kHe|lloRefCo|
|00000380| 6e 09 09 09 09 3d 09 30 | 2c 09 09 09 09 2f 2a 20 |n....=.0|,..../* |
|00000390| 64 69 73 74 69 6e 67 75 | 69 73 68 65 73 20 62 65 |distingu|ishes be|
|000003a0| 74 77 65 65 6e 20 64 69 | 66 66 65 72 65 6e 74 20 |tween di|fferent |
|000003b0| 72 65 73 75 6c 74 73 20 | 2a 2f 0d 09 6b 47 6f 6f |results |*/..kGoo|
|000003c0| 64 62 79 65 52 65 66 43 | 6f 6e 2c 0d 09 6b 57 68 |dbyeRefC|on,..kWh|
|000003d0| 61 74 54 69 6d 65 49 73 | 49 74 52 65 66 43 6f 6e |atTimeIs|ItRefCon|
|000003e0| 2c 0d 09 6b 43 6f 6d 70 | 61 6e 79 52 65 66 43 6f |,..kComp|anyRefCo|
|000003f0| 6e 2c 0d 09 6b 41 70 70 | 6c 65 52 65 66 43 6f 6e |n,..kApp|leRefCon|
|00000400| 09 09 09 09 3d 09 30 2c | 0d 09 6b 4e 65 74 73 63 |....=.0,|..kNetsc|
|00000410| 61 70 65 52 65 66 43 6f | 6e 2c 0d 09 6b 43 6f 63 |apeRefCo|n,..kCoc|
|00000420| 61 43 6f 6c 61 52 65 66 | 43 6f 6e 2c 0d 09 0d 09 |aColaRef|Con,....|
|00000430| 6b 45 72 72 6f 72 41 6c | 65 72 74 52 65 73 49 44 |kErrorAl|ertResID|
|00000440| 09 09 09 3d 09 31 32 39 | 2c 0d 09 6b 45 72 72 53 |...=.129|,..kErrS|
|00000450| 74 72 69 6e 67 54 79 70 | 65 09 09 09 09 3d 09 27 |tringTyp|e....=.'|
|00000460| 45 73 74 72 27 2c 0d 09 | 6b 49 6e 74 65 72 6e 61 |Estr',..|kInterna|
|00000470| 6c 45 72 72 6f 72 09 09 | 09 09 3d 09 31 30 30 2c |lError..|..=.100,|
|00000480| 0d 09 6b 42 61 64 53 52 | 4d 56 65 72 73 69 6f 6e |..kBadSR|MVersion|
|00000490| 0d 7d 3b 0d 0d 2f 2a 20 | 67 6c 6f 62 61 6c 73 20 |.};../* |globals |
|000004a0| 2a 2f 0d 44 69 61 6c 6f | 67 50 74 72 09 09 09 67 |*/.Dialo|gPtr...g|
|000004b0| 44 69 61 6c 6f 67 20 3d | 20 4e 55 4c 4c 3b 0d 0d |Dialog =| NULL;..|
|000004c0| 53 52 52 65 63 6f 67 6e | 69 74 69 6f 6e 53 79 73 |SRRecogn|itionSys|
|000004d0| 74 65 6d 09 67 52 65 63 | 6f 67 6e 69 74 69 6f 6e |tem.gRec|ognition|
|000004e0| 53 79 73 74 65 6d 09 09 | 3d 20 4e 55 4c 4c 3b 09 |System..|= NULL;.|
|000004f0| 2f 2a 20 6f 75 72 20 73 | 70 65 65 63 68 20 72 65 |/* our s|peech re|
|00000500| 63 6f 67 6e 69 74 69 6f | 6e 20 73 79 73 74 65 6d |cognitio|n system|
|00000510| 20 2a 2f 0d 53 52 52 65 | 63 6f 67 6e 69 7a 65 72 | */.SRRe|cognizer|
|00000520| 09 09 67 52 65 63 6f 67 | 6e 69 7a 65 72 09 09 09 |..gRecog|nizer...|
|00000530| 09 3d 20 4e 55 4c 4c 3b | 09 2f 2a 20 6f 75 72 20 |.= NULL;|./* our |
|00000540| 72 65 63 6f 67 6e 69 7a | 65 72 20 2a 2f 0d 53 52 |recogniz|er */.SR|
|00000550| 4c 61 6e 67 75 61 67 65 | 4d 6f 64 65 6c 09 09 67 |Language|Model..g|
|00000560| 54 6f 70 4c 61 6e 67 75 | 61 67 65 4d 6f 64 65 6c |TopLangu|ageModel|
|00000570| 09 09 3d 20 4e 55 4c 4c | 3b 09 2f 2a 20 6f 75 72 |..= NULL|;./* our|
|00000580| 20 6c 61 6e 67 75 61 67 | 65 20 6d 6f 64 65 6c 20 | languag|e model |
|00000590| 2d 20 77 68 61 74 20 77 | 65 27 72 65 20 6c 69 73 |- what w|e're lis|
|000005a0| 74 65 6e 69 6e 67 20 66 | 6f 72 20 2a 2f 0d 41 45 |tening f|or */.AE|
|000005b0| 45 76 65 6e 74 48 61 6e | 64 6c 65 72 55 50 50 09 |EventHan|dlerUPP.|
|000005c0| 67 41 45 52 6f 75 74 69 | 6e 65 44 65 73 63 72 69 |gAERouti|neDescri|
|000005d0| 70 74 6f 72 09 3d 20 4e | 55 4c 4c 3b 09 2f 2a 20 |ptor.= N|ULL;./* |
|000005e0| 6f 75 72 20 41 70 70 6c | 65 45 76 65 6e 74 20 72 |our Appl|eEvent r|
|000005f0| 6f 75 74 69 6e 65 20 64 | 65 73 63 72 69 70 74 6f |outine d|escripto|
|00000600| 72 20 2a 2f 0d 0d 2f 2a | 20 70 72 6f 74 6f 74 79 |r */../*| prototy|
|00000610| 70 65 73 20 2a 2f 0d 0d | 76 6f 69 64 09 09 09 6d |pes */..|void...m|
|00000620| 61 69 6e 28 76 6f 69 64 | 29 3b 0d 4f 53 45 72 72 |ain(void|);.OSErr|
|00000630| 20 09 09 09 44 6f 4d 61 | 69 6e 45 76 65 6e 74 4c | ...DoMa|inEventL|
|00000640| 6f 6f 70 20 28 76 6f 69 | 64 29 3b 0d 42 6f 6f 6c |oop (voi|d);.Bool|
|00000650| 65 61 6e 20 09 09 48 61 | 73 56 61 6c 69 64 53 70 |ean ..Ha|sValidSp|
|00000660| 65 65 63 68 52 65 63 6f | 67 6e 69 74 69 6f 6e 56 |eechReco|gnitionV|
|00000670| 65 72 73 69 6f 6e 20 28 | 76 6f 69 64 29 3b 0d 4f |ersion (|void);.O|
|00000680| 53 45 72 72 20 09 09 09 | 49 6e 69 74 53 70 65 65 |SErr ...|InitSpee|
|00000690| 63 68 52 65 63 6f 67 6e | 69 74 69 6f 6e 20 28 76 |chRecogn|ition (v|
|000006a0| 6f 69 64 29 3b 0d 4f 53 | 45 72 72 20 09 09 09 54 |oid);.OS|Err ...T|
|000006b0| 65 72 6d 69 6e 61 74 65 | 53 70 65 65 63 68 52 65 |erminate|SpeechRe|
|000006c0| 63 6f 67 6e 69 74 69 6f | 6e 20 28 76 6f 69 64 29 |cognitio|n (void)|
|000006d0| 3b 0d 4f 53 45 72 72 09 | 09 09 42 75 69 6c 64 4c |;.OSErr.|..BuildL|
|000006e0| 61 6e 67 75 61 67 65 4d | 6f 64 65 6c 20 28 76 6f |anguageM|odel (vo|
|000006f0| 69 64 29 3b 0d 4f 53 45 | 72 72 09 09 09 41 64 64 |id);.OSE|rr...Add|
|00000700| 46 61 6e 63 69 65 72 4c | 61 6e 67 75 61 67 65 4d |FancierL|anguageM|
|00000710| 6f 64 65 6c 20 28 53 52 | 4c 61 6e 67 75 61 67 65 |odel (SR|Language|
|00000720| 4d 6f 64 65 6c 20 62 61 | 73 65 4c 4d 29 3b 0d 70 |Model ba|seLM);.p|
|00000730| 61 73 63 61 6c 20 4f 53 | 45 72 72 20 09 48 61 6e |ascal OS|Err .Han|
|00000740| 64 6c 65 52 65 63 6f 67 | 6e 69 74 69 6f 6e 44 6f |dleRecog|nitionDo|
|00000750| 6e 65 41 45 20 28 41 70 | 70 6c 65 45 76 65 6e 74 |neAE (Ap|pleEvent|
|00000760| 20 2a 74 68 65 41 45 65 | 76 74 2c 20 41 70 70 6c | *theAEe|vt, Appl|
|00000770| 65 45 76 65 6e 74 20 2a | 72 65 70 6c 79 2c 20 6c |eEvent *|reply, l|
|00000780| 6f 6e 67 20 72 65 66 63 | 6f 6e 29 3b 0d 4f 53 45 |ong refc|on);.OSE|
|00000790| 72 72 09 09 09 50 72 6f | 63 65 73 73 52 65 63 6f |rr...Pro|cessReco|
|000007a0| 67 6e 69 74 69 6f 6e 52 | 65 73 75 6c 74 20 28 53 |gnitionR|esult (S|
|000007b0| 52 52 65 63 6f 67 6e 69 | 74 69 6f 6e 52 65 73 75 |RRecogni|tionResu|
|000007c0| 6c 74 20 72 65 73 75 6c | 74 2c 20 53 52 52 65 63 |lt resul|t, SRRec|
|000007d0| 6f 67 6e 69 7a 65 72 20 | 72 65 63 6f 67 6e 69 7a |ognizer |recogniz|
|000007e0| 65 72 29 3b 0d 4f 53 45 | 72 72 09 09 09 50 72 6f |er);.OSE|rr...Pro|
|000007f0| 63 65 73 73 46 61 6e 63 | 69 65 72 4c 61 6e 67 75 |cessFanc|ierLangu|
|00000800| 61 67 65 4d 6f 64 65 6c | 20 28 53 52 50 61 74 68 |ageModel| (SRPath|
|00000810| 20 72 65 73 75 6c 74 50 | 61 74 68 2c 20 53 52 52 | resultP|ath, SRR|
|00000820| 65 63 6f 67 6e 69 7a 65 | 72 20 72 65 63 6f 67 6e |ecognize|r recogn|
|00000830| 69 7a 65 72 29 3b 0d 4f | 53 45 72 72 20 09 09 09 |izer);.O|SErr ...|
|00000840| 44 69 73 70 6c 61 79 52 | 65 63 6f 67 6e 69 7a 65 |DisplayR|ecognize|
|00000850| 64 54 65 78 74 20 28 53 | 52 52 65 63 6f 67 6e 69 |dText (S|RRecogni|
|00000860| 74 69 6f 6e 52 65 73 75 | 6c 74 20 72 65 73 75 6c |tionResu|lt resul|
|00000870| 74 29 3b 0d 76 6f 69 64 | 20 09 09 09 45 72 72 6f |t);.void| ...Erro|
|00000880| 72 41 6c 65 72 74 20 28 | 4f 53 45 72 72 20 6d 61 |rAlert (|OSErr ma|
|00000890| 63 45 72 72 29 3b 0d 4f | 53 45 72 72 20 09 09 09 |cErr);.O|SErr ...|
|000008a0| 44 69 73 61 62 6c 65 53 | 74 6f 63 6b 50 61 74 68 |DisableS|tockPath|
|000008b0| 20 28 29 3b 0d 4f 53 45 | 72 72 09 09 09 52 65 66 | ();.OSE|rr...Ref|
|000008c0| 69 6c 6c 43 6f 6d 70 61 | 6e 79 4c 4d 20 28 29 3b |illCompa|nyLM ();|
|000008d0| 0d 4f 53 45 72 72 20 09 | 09 09 53 61 76 65 54 6f |.OSErr .|..SaveTo|
|000008e0| 70 4c 61 6e 67 75 61 67 | 65 4d 6f 64 65 6c 20 28 |pLanguag|eModel (|
|000008f0| 29 3b 0d 0d 2f 2a 09 6d | 61 69 6e 20 65 6e 74 72 |);../*.m|ain entr|
|00000900| 79 20 70 6f 69 6e 74 0d | 0d 09 52 65 6d 65 6d 62 |y point.|..Rememb|
|00000910| 65 72 2c 20 74 68 69 73 | 20 61 70 70 6c 69 63 61 |er, this| applica|
|00000920| 74 69 6f 6e 20 69 73 20 | 6d 65 61 6e 74 20 74 6f |tion is |meant to|
|00000930| 20 73 68 6f 77 20 79 6f | 75 20 68 6f 77 20 74 6f | show yo|u how to|
|00000940| 20 75 73 65 20 74 68 65 | 20 0d 09 53 70 65 65 63 | use the| ..Speec|
|00000950| 68 20 52 65 63 6f 67 6e | 69 74 69 6f 6e 20 4d 61 |h Recogn|ition Ma|
|00000960| 6e 61 67 65 72 2c 20 6e | 6f 74 20 74 6f 20 73 68 |nager, n|ot to sh|
|00000970| 6f 77 20 67 6f 6f 64 20 | 68 75 6d 61 6e 20 69 6e |ow good |human in|
|00000980| 74 65 72 66 61 63 65 20 | 70 72 6f 67 72 61 6d 6d |terface |programm|
|00000990| 69 6e 67 2e 20 0d 09 54 | 68 65 20 66 6f 6c 6c 6f |ing. ..T|he follo|
|000009a0| 77 69 6e 67 20 63 6f 64 | 65 20 74 6f 20 6d 61 6e |wing cod|e to man|
|000009b0| 61 67 65 20 74 68 65 20 | 64 69 61 6c 6f 67 20 69 |age the |dialog i|
|000009c0| 73 20 6e 6f 74 20 6d 65 | 61 6e 74 20 74 6f 20 62 |s not me|ant to b|
|000009d0| 65 20 61 20 67 6f 6f 64 | 20 65 78 61 6d 70 6c 65 |e a good| example|
|000009e0| 20 0d 09 6f 66 20 61 70 | 70 6c 69 63 61 74 69 6f | ..of ap|plicatio|
|000009f0| 6e 20 64 65 73 69 67 6e | 2e 0d 2a 2f 0d 0d 76 6f |n design|..*/..vo|
|00000a00| 69 64 20 6d 61 69 6e 28 | 76 6f 69 64 29 0d 7b 0d |id main(|void).{.|
|00000a10| 09 4f 53 45 72 72 09 09 | 09 73 74 61 74 75 73 20 |.OSErr..|.status |
|00000a20| 3d 20 6e 6f 45 72 72 3b | 0d 0d 09 2f 2a 20 69 6e |= noErr;|.../* in|
|00000a30| 69 74 69 61 6c 69 7a 65 | 20 74 68 65 20 77 6f 72 |itialize| the wor|
|00000a40| 6c 64 20 2a 2f 0d 0d 09 | 49 6e 69 74 47 72 61 66 |ld */...|InitGraf|
|00000a50| 28 28 50 74 72 29 20 26 | 71 64 2e 74 68 65 50 6f |((Ptr) &|qd.thePo|
|00000a60| 72 74 29 3b 0d 09 49 6e | 69 74 46 6f 6e 74 73 28 |rt);..In|itFonts(|
|00000a70| 29 3b 0d 09 49 6e 69 74 | 57 69 6e 64 6f 77 73 28 |);..Init|Windows(|
|00000a80| 29 3b 0d 09 49 6e 69 74 | 4d 65 6e 75 73 28 29 3b |);..Init|Menus();|
|00000a90| 0d 09 54 45 49 6e 69 74 | 28 29 3b 0d 09 49 6e 69 |..TEInit|();..Ini|
|00000aa0| 74 44 69 61 6c 6f 67 73 | 28 6e 69 6c 29 3b 0d 09 |tDialogs|(nil);..|
|00000ab0| 49 6e 69 74 43 75 72 73 | 6f 72 28 29 3b 0d 09 4d |InitCurs|or();..M|
|00000ac0| 61 78 41 70 70 6c 5a 6f | 6e 65 28 29 3b 0d 0d 09 |axApplZo|ne();...|
|00000ad0| 73 74 61 74 75 73 20 3d | 20 49 6e 69 74 53 70 65 |status =| InitSpe|
|00000ae0| 65 63 68 52 65 63 6f 67 | 6e 69 74 69 6f 6e 20 28 |echRecog|nition (|
|00000af0| 29 3b 0d 09 0d 09 69 66 | 20 28 21 73 74 61 74 75 |);....if| (!statu|
|00000b00| 73 29 20 7b 0d 09 09 73 | 74 61 74 75 73 20 3d 20 |s) {...s|tatus = |
|00000b10| 42 75 69 6c 64 4c 61 6e | 67 75 61 67 65 4d 6f 64 |BuildLan|guageMod|
|00000b20| 65 6c 20 28 29 3b 0d 09 | 09 0d 09 09 69 66 20 28 |el ();..|....if (|
|00000b30| 21 73 74 61 74 75 73 29 | 0d 09 09 09 73 74 61 74 |!status)|....stat|
|00000b40| 75 73 20 3d 20 53 52 53 | 65 74 4c 61 6e 67 75 61 |us = SRS|etLangua|
|00000b50| 67 65 4d 6f 64 65 6c 20 | 28 67 52 65 63 6f 67 6e |geModel |(gRecogn|
|00000b60| 69 7a 65 72 2c 20 67 54 | 6f 70 4c 61 6e 67 75 61 |izer, gT|opLangua|
|00000b70| 67 65 4d 6f 64 65 6c 29 | 3b 0d 0d 09 09 69 66 20 |geModel)|;....if |
|00000b80| 28 21 73 74 61 74 75 73 | 29 20 7b 0d 09 09 09 73 |(!status|) {....s|
|00000b90| 74 61 74 75 73 20 3d 20 | 53 52 53 74 61 72 74 4c |tatus = |SRStartL|
|00000ba0| 69 73 74 65 6e 69 6e 67 | 20 28 67 52 65 63 6f 67 |istening| (gRecog|
|00000bb0| 6e 69 7a 65 72 29 3b 0d | 09 09 09 0d 09 09 09 69 |nizer);.|.......i|
|00000bc0| 66 20 28 21 73 74 61 74 | 75 73 29 20 73 74 61 74 |f (!stat|us) stat|
|00000bd0| 75 73 20 3d 20 44 6f 4d | 61 69 6e 45 76 65 6e 74 |us = DoM|ainEvent|
|00000be0| 4c 6f 6f 70 20 28 29 3b | 09 2f 2a 20 69 67 6e 6f |Loop ();|./* igno|
|00000bf0| 72 65 20 73 74 61 74 75 | 73 20 2a 2f 0d 09 09 09 |re statu|s */....|
|00000c00| 09 0d 09 09 09 73 74 61 | 74 75 73 20 3d 20 53 52 |.....sta|tus = SR|
|00000c10| 53 74 6f 70 4c 69 73 74 | 65 6e 69 6e 67 20 28 67 |StopList|ening (g|
|00000c20| 52 65 63 6f 67 6e 69 7a | 65 72 29 3b 0d 09 09 7d |Recogniz|er);...}|
|00000c30| 0d 09 09 0d 09 09 54 65 | 72 6d 69 6e 61 74 65 53 |......Te|rminateS|
|00000c40| 70 65 65 63 68 52 65 63 | 6f 67 6e 69 74 69 6f 6e |peechRec|ognition|
|00000c50| 20 28 29 3b 09 09 09 09 | 09 2f 2a 20 69 67 6e 6f | ();....|./* igno|
|00000c60| 72 65 20 73 74 61 74 75 | 73 20 2a 2f 0d 09 7d 0d |re statu|s */..}.|
|00000c70| 09 0d 09 69 66 20 28 73 | 74 61 74 75 73 29 0d 09 |...if (s|tatus)..|
|00000c80| 09 45 72 72 6f 72 41 6c | 65 72 74 20 28 73 74 61 |.ErrorAl|ert (sta|
|00000c90| 74 75 73 29 3b 0d 7d 0d | 0d 0d 2f 2a 09 44 6f 4d |tus);.}.|../*.DoM|
|00000ca0| 61 69 6e 45 76 65 6e 74 | 4c 6f 6f 70 0d 0d 09 42 |ainEvent|Loop...B|
|00000cb0| 72 69 6e 67 73 20 75 70 | 20 6f 75 72 20 73 69 6d |rings up| our sim|
|00000cc0| 70 6c 65 20 64 69 61 6c | 6f 67 2e 20 20 54 68 65 |ple dial|og. The|
|00000cd0| 6e 20 70 72 6f 63 65 73 | 73 65 73 20 74 68 65 20 |n proces|ses the |
|00000ce0| 65 76 65 6e 74 73 20 61 | 73 20 74 68 65 79 20 63 |events a|s they c|
|00000cf0| 6f 6d 65 2e 0d 2a 2f 0d | 0d 4f 53 45 72 72 20 44 |ome..*/.|.OSErr D|
|00000d00| 6f 4d 61 69 6e 45 76 65 | 6e 74 4c 6f 6f 70 20 28 |oMainEve|ntLoop (|
|00000d10| 76 6f 69 64 29 0d 7b 0d | 09 4f 53 45 72 72 09 09 |void).{.|.OSErr..|
|00000d20| 09 73 74 61 74 75 73 20 | 3d 20 6e 6f 45 72 72 3b |.status |= noErr;|
|00000d30| 0d 09 47 72 61 66 50 74 | 72 09 09 09 6f 6c 64 50 |..GrafPt|r...oldP|
|00000d40| 6f 72 74 3b 0d 09 0d 09 | 2f 2a 20 73 65 74 75 70 |ort;....|/* setup|
|00000d50| 20 6d 61 69 6e 20 77 69 | 6e 64 6f 77 20 2a 2f 0d | main wi|ndow */.|
|00000d60| 09 47 65 74 50 6f 72 74 | 20 28 26 6f 6c 64 50 6f |.GetPort| (&oldPo|
|00000d70| 72 74 29 3b 0d 0d 09 67 | 44 69 61 6c 6f 67 20 3d |rt);...g|Dialog =|
|00000d80| 20 47 65 74 4e 65 77 44 | 69 61 6c 6f 67 20 28 6b | GetNewD|ialog (k|
|00000d90| 44 69 61 6c 6f 67 52 65 | 73 49 44 2c 20 6e 69 6c |DialogRe|sID, nil|
|00000da0| 2c 20 28 57 69 6e 64 6f | 77 50 74 72 29 20 2d 31 |, (Windo|wPtr) -1|
|00000db0| 29 3b 0d 09 69 66 20 28 | 67 44 69 61 6c 6f 67 29 |);..if (|gDialog)|
|00000dc0| 20 7b 0d 09 09 42 6f 6f | 6c 65 61 6e 09 09 09 64 | {...Boo|lean...d|
|00000dd0| 6f 6e 65 20 3d 20 66 61 | 6c 73 65 3b 0d 09 09 53 |one = fa|lse;...S|
|00000de0| 65 74 50 6f 72 74 20 28 | 67 44 69 61 6c 6f 67 29 |etPort (|gDialog)|
|00000df0| 3b 0d 09 09 53 68 6f 77 | 57 69 6e 64 6f 77 20 28 |;...Show|Window (|
|00000e00| 67 44 69 61 6c 6f 67 29 | 3b 0d 0d 09 09 2f 2a 20 |gDialog)|;..../* |
|00000e10| 6d 61 69 6e 20 65 76 65 | 6e 74 20 6c 6f 6f 70 20 |main eve|nt loop |
|00000e20| 2a 2f 0d 09 09 77 68 69 | 6c 65 20 28 21 64 6f 6e |*/...whi|le (!don|
|00000e30| 65 29 20 7b 0d 09 09 09 | 44 69 61 6c 6f 67 50 74 |e) {....|DialogPt|
|00000e40| 72 20 64 6c 6f 67 3b 0d | 09 09 09 45 76 65 6e 74 |r dlog;.|...Event|
|00000e50| 52 65 63 6f 72 64 20 65 | 76 65 6e 74 3b 0d 0d 09 |Record e|vent;...|
|00000e60| 09 09 69 66 20 28 57 61 | 69 74 4e 65 78 74 45 76 |..if (Wa|itNextEv|
|00000e70| 65 6e 74 20 28 65 76 65 | 72 79 45 76 65 6e 74 2c |ent (eve|ryEvent,|
|00000e80| 20 26 65 76 65 6e 74 2c | 20 31 30 2c 20 4e 55 4c | &event,| 10, NUL|
|00000e90| 4c 29 29 20 7b 0d 0d 09 | 09 09 09 2f 2a 20 69 66 |L)) {...|.../* if|
|00000ea0| 20 61 20 64 69 61 6c 6f | 67 20 65 76 65 6e 74 2c | a dialo|g event,|
|00000eb0| 20 64 6f 20 74 68 65 20 | 64 69 61 6c 6f 67 20 74 | do the |dialog t|
|00000ec0| 68 69 6e 67 2e 2e 2e 20 | 2a 2f 0d 09 09 09 09 69 |hing... |*/.....i|
|00000ed0| 66 20 28 49 73 44 69 61 | 6c 6f 67 45 76 65 6e 74 |f (IsDia|logEvent|
|00000ee0| 20 28 26 65 76 65 6e 74 | 29 29 20 7b 0d 09 09 09 | (&event|)) {....|
|00000ef0| 09 09 73 68 6f 72 74 20 | 69 74 65 6d 48 69 74 3b |..short |itemHit;|
|00000f00| 0d 09 09 09 09 09 0d 09 | 09 09 09 09 69 66 20 28 |........|....if (|
|00000f10| 44 69 61 6c 6f 67 53 65 | 6c 65 63 74 20 28 26 65 |DialogSe|lect (&e|
|00000f20| 76 65 6e 74 2c 20 26 64 | 6c 6f 67 2c 20 26 69 74 |vent, &d|log, &it|
|00000f30| 65 6d 48 69 74 29 29 20 | 7b 0d 09 09 09 09 09 09 |emHit)) |{.......|
|00000f40| 73 77 69 74 63 68 20 28 | 69 74 65 6d 48 69 74 29 |switch (|itemHit)|
|00000f50| 20 7b 0d 09 09 09 09 09 | 09 09 63 61 73 65 20 6b | {......|..case k|
|00000f60| 51 75 69 74 42 75 74 74 | 6f 6e 3a 0d 09 09 09 09 |QuitButt|on:.....|
|00000f70| 09 09 09 09 64 6f 6e 65 | 20 3d 20 74 72 75 65 3b |....done| = true;|
|00000f80| 0d 09 09 09 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |........|.break;.|
|00000f90| 09 09 09 09 09 09 7d 0d | 09 09 09 09 09 7d 0d 09 |......}.|.....}..|
|00000fa0| 09 09 09 7d 0d 09 09 09 | 09 0d 09 09 09 09 2f 2a |...}....|....../*|
|00000fb0| 20 2e 2e 2e 6f 74 68 65 | 72 77 69 73 65 20 69 74 | ...othe|rwise it|
|00000fc0| 27 73 20 61 20 6e 6f 72 | 6d 61 6c 20 65 76 65 6e |'s a nor|mal even|
|00000fd0| 74 20 2a 2f 0d 09 09 09 | 09 65 6c 73 65 20 7b 0d |t */....|.else {.|
|00000fe0| 09 09 09 09 09 73 77 69 | 74 63 68 20 28 65 76 65 |.....swi|tch (eve|
|00000ff0| 6e 74 2e 77 68 61 74 29 | 20 7b 0d 09 09 09 09 09 |nt.what)| {......|
|00001000| 09 63 61 73 65 20 6e 75 | 6c 6c 45 76 65 6e 74 3a |.case nu|llEvent:|
|00001010| 0d 09 09 09 09 09 09 63 | 61 73 65 20 6d 6f 75 73 |.......c|ase mous|
|00001020| 65 44 6f 77 6e 3a 0d 09 | 09 09 09 09 09 09 7b 0d |eDown:..|......{.|
|00001030| 09 09 09 09 09 09 09 09 | 73 68 6f 72 74 20 70 61 |........|short pa|
|00001040| 72 74 43 6f 64 65 3b 0d | 09 09 09 09 09 09 09 09 |rtCode;.|........|
|00001050| 73 77 69 74 63 68 20 28 | 70 61 72 74 43 6f 64 65 |switch (|partCode|
|00001060| 20 3d 20 46 69 6e 64 57 | 69 6e 64 6f 77 20 28 65 | = FindW|indow (e|
|00001070| 76 65 6e 74 2e 77 68 65 | 72 65 2c 20 26 64 6c 6f |vent.whe|re, &dlo|
|00001080| 67 29 29 20 7b 0d 09 09 | 09 09 09 09 09 09 09 63 |g)) {...|.......c|
|00001090| 61 73 65 20 69 6e 44 72 | 61 67 3a 0d 09 09 09 09 |ase inDr|ag:.....|
|000010a0| 09 09 09 09 09 09 44 72 | 61 67 57 69 6e 64 6f 77 |......Dr|agWindow|
|000010b0| 20 28 64 6c 6f 67 2c 20 | 65 76 65 6e 74 2e 77 68 | (dlog, |event.wh|
|000010c0| 65 72 65 2c 20 26 71 64 | 2e 73 63 72 65 65 6e 42 |ere, &qd|.screenB|
|000010d0| 69 74 73 2e 62 6f 75 6e | 64 73 29 3b 0d 09 09 09 |its.boun|ds);....|
|000010e0| 09 09 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |.......b|reak;...|
|000010f0| 09 09 09 09 09 09 7d 0d | 09 09 09 09 09 09 09 7d |......}.|.......}|
|00001100| 0d 09 09 09 09 09 09 09 | 62 72 65 61 6b 3b 0d 09 |........|break;..|
|00001110| 09 09 09 09 09 63 61 73 | 65 20 6b 48 69 67 68 4c |.....cas|e kHighL|
|00001120| 65 76 65 6c 45 76 65 6e | 74 3a 0d 09 09 09 09 09 |evelEven|t:......|
|00001130| 09 09 41 45 50 72 6f 63 | 65 73 73 41 70 70 6c 65 |..AEProc|essApple|
|00001140| 45 76 65 6e 74 20 28 26 | 65 76 65 6e 74 29 3b 0d |Event (&|event);.|
|00001150| 09 09 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |.......b|reak;...|
|00001160| 09 09 09 09 63 61 73 65 | 20 6b 65 79 44 6f 77 6e |....case| keyDown|
|00001170| 3a 0d 09 09 09 09 09 09 | 63 61 73 65 20 61 75 74 |:.......|case aut|
|00001180| 6f 4b 65 79 3a 20 20 20 | 20 20 20 20 20 20 20 20 |oKey: | |
|00001190| 20 20 20 20 20 20 20 20 | 20 20 20 0d 09 09 09 09 | | .....|
|000011a0| 09 09 63 61 73 65 20 64 | 69 73 6b 45 76 74 3a 0d |..case d|iskEvt:.|
|000011b0| 09 09 09 09 09 09 64 65 | 66 61 75 6c 74 3a 0d 09 |......de|fault:..|
|000011c0| 09 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|000011d0| 09 09 7d 0d 09 09 09 09 | 7d 0d 09 09 09 7d 0d 09 |..}.....|}....}..|
|000011e0| 09 7d 0d 09 09 44 69 73 | 70 6f 73 65 44 69 61 6c |.}...Dis|poseDial|
|000011f0| 6f 67 20 28 67 44 69 61 | 6c 6f 67 29 3b 0d 09 7d |og (gDia|log);..}|
|00001200| 0d 09 65 6c 73 65 20 73 | 74 61 74 75 73 20 3d 20 |..else s|tatus = |
|00001210| 6b 49 6e 74 65 72 6e 61 | 6c 45 72 72 6f 72 3b 0d |kInterna|lError;.|
|00001220| 0d 09 53 65 74 50 6f 72 | 74 28 6f 6c 64 50 6f 72 |..SetPor|t(oldPor|
|00001230| 74 29 3b 0d 09 0d 09 72 | 65 74 75 72 6e 20 73 74 |t);....r|eturn st|
|00001240| 61 74 75 73 3b 0d 7d 0d | 0d 2f 2a 09 48 61 73 56 |atus;.}.|./*.HasV|
|00001250| 61 6c 69 64 53 70 65 65 | 63 68 52 65 63 6f 67 6e |alidSpee|chRecogn|
|00001260| 69 74 69 6f 6e 56 65 72 | 73 69 6f 6e 0d 0d 09 54 |itionVer|sion...T|
|00001270| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 63 68 65 63 |his rout|ine chec|
|00001280| 6b 73 20 74 68 65 20 53 | 70 65 65 63 68 20 52 65 |ks the S|peech Re|
|00001290| 63 6f 67 6e 69 74 69 6f | 6e 20 4d 61 6e 61 67 65 |cognitio|n Manage|
|000012a0| 72 20 76 65 72 73 69 6f | 6e 20 61 6e 64 20 6d 61 |r versio|n and ma|
|000012b0| 6b 65 73 20 73 75 72 65 | 20 74 68 65 20 76 65 72 |kes sure| the ver|
|000012c0| 73 69 6f 6e 20 0d 09 69 | 73 20 67 72 65 61 74 65 |sion ..i|s greate|
|000012d0| 72 20 74 68 61 6e 20 6f | 72 20 65 71 75 61 6c 20 |r than o|r equal |
|000012e0| 74 6f 20 74 68 65 20 76 | 65 72 73 69 6f 6e 20 6e |to the v|ersion n|
|000012f0| 65 65 64 65 64 20 66 6f | 72 20 74 68 69 73 20 70 |eeded fo|r this p|
|00001300| 72 6f 67 72 61 6d 20 74 | 6f 20 72 75 6e 2e 20 20 |rogram t|o run. |
|00001310| 4f 6e 6c 79 20 53 70 65 | 65 63 68 0d 09 52 65 63 |Only Spe|ech..Rec|
|00001320| 6f 67 6e 69 74 69 6f 6e | 20 4d 61 6e 61 67 65 72 |ognition| Manager|
|00001330| 20 76 65 72 73 69 6f 6e | 73 20 3e 3d 20 31 2e 35 | version|s >= 1.5|
|00001340| 20 61 64 68 65 72 65 20 | 74 6f 20 74 68 65 20 70 | adhere |to the p|
|00001350| 75 62 6c 69 63 6c 79 20 | 64 65 66 69 6e 65 64 20 |ublicly |defined |
|00001360| 41 50 49 2e 0d 2a 2f 0d | 0d 42 6f 6f 6c 65 61 6e |API..*/.|.Boolean|
|00001370| 20 48 61 73 56 61 6c 69 | 64 53 70 65 65 63 68 52 | HasVali|dSpeechR|
|00001380| 65 63 6f 67 6e 69 74 69 | 6f 6e 56 65 72 73 69 6f |ecogniti|onVersio|
|00001390| 6e 20 28 76 6f 69 64 29 | 0d 7b 0d 09 4f 53 45 72 |n (void)|.{..OSEr|
|000013a0| 72 09 09 09 09 09 73 74 | 61 74 75 73 3b 0d 09 6c |r.....st|atus;..l|
|000013b0| 6f 6e 67 09 09 09 09 09 | 74 68 65 56 65 72 73 69 |ong.....|theVersi|
|000013c0| 6f 6e 3b 0d 09 42 6f 6f | 6c 65 61 6e 20 09 09 09 |on;..Boo|lean ...|
|000013d0| 09 76 61 6c 69 64 56 65 | 72 73 69 6f 6e 09 09 09 |.validVe|rsion...|
|000013e0| 09 3d 20 66 61 6c 73 65 | 3b 0d 09 63 6f 6e 73 74 |.= false|;..const|
|000013f0| 20 75 6e 73 69 67 6e 65 | 64 20 6c 6f 6e 67 20 09 | unsigne|d long .|
|00001400| 6b 4d 69 6e 69 6d 75 6d | 52 65 71 75 69 72 65 64 |kMinimum|Required|
|00001410| 53 52 4d 56 65 72 73 69 | 6f 6e 09 3d 20 30 78 30 |SRMVersi|on.= 0x0|
|00001420| 30 30 30 30 31 35 30 3b | 0d 09 0d 09 73 74 61 74 |0000150;|....stat|
|00001430| 75 73 20 3d 20 47 65 73 | 74 61 6c 74 20 28 67 65 |us = Ges|talt (ge|
|00001440| 73 74 61 6c 74 53 70 65 | 65 63 68 52 65 63 6f 67 |staltSpe|echRecog|
|00001450| 6e 69 74 69 6f 6e 56 65 | 72 73 69 6f 6e 2c 20 26 |nitionVe|rsion, &|
|00001460| 74 68 65 56 65 72 73 69 | 6f 6e 29 3b 0d 09 0d 09 |theVersi|on);....|
|00001470| 69 66 20 28 21 73 74 61 | 74 75 73 29 0d 09 09 69 |if (!sta|tus)...i|
|00001480| 66 20 28 74 68 65 56 65 | 72 73 69 6f 6e 20 3e 3d |f (theVe|rsion >=|
|00001490| 20 6b 4d 69 6e 69 6d 75 | 6d 52 65 71 75 69 72 65 | kMinimu|mRequire|
|000014a0| 64 53 52 4d 56 65 72 73 | 69 6f 6e 29 0d 09 09 09 |dSRMVers|ion)....|
|000014b0| 76 61 6c 69 64 56 65 72 | 73 69 6f 6e 20 3d 20 74 |validVer|sion = t|
|000014c0| 72 75 65 3b 0d 09 09 09 | 0d 09 72 65 74 75 72 6e |rue;....|..return|
|000014d0| 20 76 61 6c 69 64 56 65 | 72 73 69 6f 6e 3b 0d 7d | validVe|rsion;.}|
|000014e0| 0d 0d 2f 2a 09 49 6e 69 | 74 53 70 65 65 63 68 52 |../*.Ini|tSpeechR|
|000014f0| 65 63 6f 67 6e 69 74 69 | 6f 6e 0d 0d 09 49 66 20 |ecogniti|on...If |
|00001500| 74 68 65 20 53 70 65 65 | 63 68 20 52 65 63 6f 67 |the Spee|ch Recog|
|00001510| 6e 69 74 69 6f 6e 20 4d | 61 6e 61 67 65 72 20 76 |nition M|anager v|
|00001520| 65 72 73 69 6f 6e 20 69 | 73 20 76 61 6c 69 64 2c |ersion i|s valid,|
|00001530| 20 74 68 69 73 20 72 6f | 75 74 69 6e 65 20 6f 70 | this ro|utine op|
|00001540| 65 6e 73 20 61 20 72 65 | 63 6f 67 6e 69 74 69 6f |ens a re|cognitio|
|00001550| 6e 20 73 79 73 74 65 6d | 0d 09 61 6e 64 20 61 20 |n system|..and a |
|00001560| 72 65 63 6f 67 6e 69 7a | 65 72 2c 20 73 65 74 74 |recogniz|er, sett|
|00001570| 69 6e 67 20 74 68 65 20 | 6b 53 52 46 65 65 64 62 |ing the |kSRFeedb|
|00001580| 61 63 6b 41 6e 64 4c 69 | 73 74 65 6e 69 6e 67 4d |ackAndLi|steningM|
|00001590| 6f 64 65 73 20 70 72 6f | 70 65 72 74 79 20 74 6f |odes pro|perty to|
|000015a0| 20 6b 53 52 48 61 73 46 | 65 65 64 62 61 63 6b 48 | kSRHasF|eedbackH|
|000015b0| 61 73 4c 69 73 74 65 6e | 4d 6f 64 65 73 0d 09 73 |asListen|Modes..s|
|000015c0| 6f 20 74 68 61 74 20 53 | 52 53 61 6d 70 6c 65 20 |o that S|RSample |
|000015d0| 77 69 6c 6c 20 68 61 76 | 65 20 61 20 53 70 65 65 |will hav|e a Spee|
|000015e0| 63 68 20 52 65 63 6f 67 | 6e 69 74 69 6f 6e 20 66 |ch Recog|nition f|
|000015f0| 65 65 64 62 61 63 6b 20 | 77 69 6e 64 6f 77 2e 0d |eedback |window..|
|00001600| 2a 2f 0d 0d 4f 53 45 72 | 72 20 49 6e 69 74 53 70 |*/..OSEr|r InitSp|
|00001610| 65 65 63 68 52 65 63 6f | 67 6e 69 74 69 6f 6e 20 |eechReco|gnition |
|00001620| 28 76 6f 69 64 29 0d 7b | 0d 09 4f 53 45 72 72 20 |(void).{|..OSErr |
|00001630| 73 74 61 74 75 73 20 3d | 20 6b 42 61 64 53 52 4d |status =| kBadSRM|
|00001640| 56 65 72 73 69 6f 6e 3b | 0d 09 0d 09 2f 2a 20 45 |Version;|..../* E|
|00001650| 6e 73 75 72 65 20 74 68 | 61 74 20 74 68 65 20 53 |nsure th|at the S|
|00001660| 70 65 65 63 68 20 52 65 | 63 6f 67 6e 69 74 69 6f |peech Re|cognitio|
|00001670| 6e 20 4d 67 72 20 69 73 | 20 61 76 61 69 6c 61 62 |n Mgr is| availab|
|00001680| 6c 65 2e 20 2a 2f 0d 09 | 69 66 20 28 48 61 73 56 |le. */..|if (HasV|
|00001690| 61 6c 69 64 53 70 65 65 | 63 68 52 65 63 6f 67 6e |alidSpee|chRecogn|
|000016a0| 69 74 69 6f 6e 56 65 72 | 73 69 6f 6e 20 28 29 29 |itionVer|sion ())|
|000016b0| 20 20 7b 0d 09 0d 09 09 | 2f 2a 20 4f 70 65 6e 20 | {.....|/* Open |
|000016c0| 74 68 65 20 64 65 66 61 | 75 6c 74 20 72 65 63 6f |the defa|ult reco|
|000016d0| 67 6e 69 74 69 6f 6e 20 | 73 79 73 74 65 6d 2e 20 |gnition |system. |
|000016e0| 2a 2f 0d 09 09 73 74 61 | 74 75 73 20 3d 20 53 52 |*/...sta|tus = SR|
|000016f0| 4f 70 65 6e 52 65 63 6f | 67 6e 69 74 69 6f 6e 53 |OpenReco|gnitionS|
|00001700| 79 73 74 65 6d 20 28 26 | 67 52 65 63 6f 67 6e 69 |ystem (&|gRecogni|
|00001710| 74 69 6f 6e 53 79 73 74 | 65 6d 2c 20 6b 53 52 44 |tionSyst|em, kSRD|
|00001720| 65 66 61 75 6c 74 52 65 | 63 6f 67 6e 69 74 69 6f |efaultRe|cognitio|
|00001730| 6e 53 79 73 74 65 6d 49 | 44 29 3b 0d 09 09 0d 09 |nSystemI|D);.....|
|00001740| 09 2f 2a 20 55 73 65 20 | 73 74 61 6e 64 61 72 64 |./* Use |standard|
|00001750| 20 66 65 65 64 62 61 63 | 6b 20 77 69 6e 64 6f 77 | feedbac|k window|
|00001760| 20 61 6e 64 20 6c 69 73 | 74 65 6e 69 6e 67 20 6d | and lis|tening m|
|00001770| 6f 64 65 73 2e 20 2a 2f | 0d 09 09 69 66 20 28 21 |odes. */|...if (!|
|00001780| 73 74 61 74 75 73 29 20 | 7b 0d 09 09 09 73 68 6f |status) |{....sho|
|00001790| 72 74 20 66 65 65 64 62 | 61 63 6b 4e 65 65 64 65 |rt feedb|ackNeede|
|000017a0| 64 20 3d 20 6b 53 52 48 | 61 73 46 65 65 64 62 61 |d = kSRH|asFeedba|
|000017b0| 63 6b 48 61 73 4c 69 73 | 74 65 6e 4d 6f 64 65 73 |ckHasLis|tenModes|
|000017c0| 3b 0d 09 09 09 0d 09 09 | 09 73 74 61 74 75 73 20 |;.......|.status |
|000017d0| 3d 20 53 52 53 65 74 50 | 72 6f 70 65 72 74 79 20 |= SRSetP|roperty |
|000017e0| 28 67 52 65 63 6f 67 6e | 69 74 69 6f 6e 53 79 73 |(gRecogn|itionSys|
|000017f0| 74 65 6d 2c 20 6b 53 52 | 46 65 65 64 62 61 63 6b |tem, kSR|Feedback|
|00001800| 41 6e 64 4c 69 73 74 65 | 6e 69 6e 67 4d 6f 64 65 |AndListe|ningMode|
|00001810| 73 2c 20 26 66 65 65 64 | 62 61 63 6b 4e 65 65 64 |s, &feed|backNeed|
|00001820| 65 64 2c 20 73 69 7a 65 | 6f 66 28 66 65 65 64 62 |ed, size|of(feedb|
|00001830| 61 63 6b 4e 65 65 64 65 | 64 29 29 3b 0d 09 09 7d |ackNeede|d));...}|
|00001840| 0d 09 09 0d 09 09 2f 2a | 20 43 72 65 61 74 65 20 |....../*| Create |
|00001850| 61 20 6e 65 77 20 72 65 | 63 6f 67 6e 69 7a 65 72 |a new re|cognizer|
|00001860| 20 2a 2f 0d 09 09 69 66 | 20 28 21 73 74 61 74 75 | */...if| (!statu|
|00001870| 73 29 0d 09 09 09 73 74 | 61 74 75 73 20 3d 20 53 |s)....st|atus = S|
|00001880| 52 4e 65 77 52 65 63 6f | 67 6e 69 7a 65 72 20 28 |RNewReco|gnizer (|
|00001890| 67 52 65 63 6f 67 6e 69 | 74 69 6f 6e 53 79 73 74 |gRecogni|tionSyst|
|000018a0| 65 6d 2c 20 26 67 52 65 | 63 6f 67 6e 69 7a 65 72 |em, &gRe|cognizer|
|000018b0| 2c 20 6b 53 52 44 65 66 | 61 75 6c 74 53 70 65 65 |, kSRDef|aultSpee|
|000018c0| 63 68 53 6f 75 72 63 65 | 29 3b 0d 0d 09 09 2f 2a |chSource|);..../*|
|000018d0| 20 69 6e 73 74 61 6c 6c | 20 6f 75 72 20 41 70 70 | install| our App|
|000018e0| 6c 65 20 45 76 65 6e 74 | 20 68 61 6e 64 6c 65 72 |le Event| handler|
|000018f0| 20 66 6f 72 20 72 65 63 | 6f 67 6e 69 74 69 6f 6e | for rec|ognition|
|00001900| 20 72 65 73 75 6c 74 73 | 20 2a 2f 09 09 09 0d 09 | results| */.....|
|00001910| 09 69 66 20 28 21 73 74 | 61 74 75 73 29 20 7b 0d |.if (!st|atus) {.|
|00001920| 09 09 09 73 74 61 74 75 | 73 20 3d 20 6d 65 6d 46 |...statu|s = memF|
|00001930| 75 6c 6c 45 72 72 3b 0d | 09 09 09 67 41 45 52 6f |ullErr;.|...gAERo|
|00001940| 75 74 69 6e 65 44 65 73 | 63 72 69 70 74 6f 72 20 |utineDes|criptor |
|00001950| 3d 20 4e 65 77 41 45 45 | 76 65 6e 74 48 61 6e 64 |= NewAEE|ventHand|
|00001960| 6c 65 72 50 72 6f 63 20 | 28 48 61 6e 64 6c 65 52 |lerProc |(HandleR|
|00001970| 65 63 6f 67 6e 69 74 69 | 6f 6e 44 6f 6e 65 41 45 |ecogniti|onDoneAE|
|00001980| 29 3b 0d 09 09 09 0d 09 | 09 09 69 66 20 28 67 41 |);......|..if (gA|
|00001990| 45 52 6f 75 74 69 6e 65 | 44 65 73 63 72 69 70 74 |ERoutine|Descript|
|000019a0| 6f 72 29 0d 09 09 09 09 | 73 74 61 74 75 73 20 3d |or).....|status =|
|000019b0| 20 41 45 49 6e 73 74 61 | 6c 6c 45 76 65 6e 74 48 | AEInsta|llEventH|
|000019c0| 61 6e 64 6c 65 72 20 28 | 6b 41 45 53 70 65 65 63 |andler (|kAESpeec|
|000019d0| 68 53 75 69 74 65 2c 20 | 6b 41 45 53 70 65 65 63 |hSuite, |kAESpeec|
|000019e0| 68 44 6f 6e 65 2c 20 67 | 41 45 52 6f 75 74 69 6e |hDone, g|AERoutin|
|000019f0| 65 44 65 73 63 72 69 70 | 74 6f 72 2c 20 30 2c 20 |eDescrip|tor, 0, |
|00001a00| 66 61 6c 73 65 29 3b 0d | 09 09 7d 0d 09 7d 0d 0d |false);.|..}..}..|
|00001a10| 09 72 65 74 75 72 6e 20 | 73 74 61 74 75 73 3b 0d |.return |status;.|
|00001a20| 7d 0d 0d 0d 2f 2a 09 54 | 65 72 6d 69 6e 61 74 65 |}.../*.T|erminate|
|00001a30| 53 70 65 65 63 68 52 65 | 63 6f 67 6e 69 74 69 6f |SpeechRe|cognitio|
|00001a40| 6e 0d 0d 09 43 6c 6f 73 | 65 20 64 6f 77 6e 20 74 |n...Clos|e down t|
|00001a50| 68 65 20 52 65 63 6f 67 | 6e 69 7a 65 72 20 61 6e |he Recog|nizer an|
|00001a60| 64 20 52 65 63 6f 67 6e | 69 74 69 6f 6e 53 79 73 |d Recogn|itionSys|
|00001a70| 74 65 6d 20 61 6c 6c 6f | 63 61 74 65 64 20 69 6e |tem allo|cated in|
|00001a80| 20 49 6e 69 74 53 70 65 | 65 63 68 52 65 63 6f 67 | InitSpe|echRecog|
|00001a90| 6e 69 74 69 6f 6e 2e 0d | 09 53 74 6f 70 20 6c 69 |nition..|.Stop li|
|00001aa0| 73 74 65 6e 69 6e 67 20 | 62 65 66 6f 72 65 20 72 |stening |before r|
|00001ab0| 65 6c 65 61 73 69 6e 67 | 20 74 68 65 20 72 65 63 |eleasing| the rec|
|00001ac0| 6f 67 6e 69 7a 65 72 20 | 6a 75 73 74 20 66 6f 72 |ognizer |just for|
|00001ad0| 20 74 68 6f 72 6f 75 67 | 68 6e 65 73 73 20 28 69 | thoroug|hness (i|
|00001ae0| 74 27 73 20 68 61 72 6d | 6c 65 73 73 0d 09 69 66 |t's harm|less..if|
|00001af0| 20 77 65 20 61 72 65 6e | 27 74 20 6c 69 73 74 65 | we aren|'t liste|
|00001b00| 6e 69 6e 67 29 2e 0d 09 | 0d 09 73 74 61 74 75 73 |ning)...|..status|
|00001b10| 20 69 73 20 69 67 6e 6f | 72 65 64 20 74 68 72 6f | is igno|red thro|
|00001b20| 75 67 6f 75 74 2e 0d 2a | 2f 0d 0d 4f 53 45 72 72 |ugout..*|/..OSErr|
|00001b30| 20 54 65 72 6d 69 6e 61 | 74 65 53 70 65 65 63 68 | Termina|teSpeech|
|00001b40| 52 65 63 6f 67 6e 69 74 | 69 6f 6e 20 28 76 6f 69 |Recognit|ion (voi|
|00001b50| 64 29 0d 7b 0d 09 4f 53 | 45 72 72 20 73 74 61 74 |d).{..OS|Err stat|
|00001b60| 75 73 20 3d 20 6e 6f 45 | 72 72 3b 0d 09 0d 09 2f |us = noE|rr;..../|
|00001b70| 2a 20 69 66 20 77 65 20 | 68 61 76 65 20 61 20 74 |* if we |have a t|
|00001b80| 6f 70 20 6c 65 76 65 6c | 20 6c 61 6e 67 75 61 67 |op level| languag|
|00001b90| 65 20 6d 6f 64 65 6c 2c | 20 72 65 6c 65 61 73 65 |e model,| release|
|00001ba0| 20 69 74 20 2a 2f 0d 09 | 69 66 20 28 67 54 6f 70 | it */..|if (gTop|
|00001bb0| 4c 61 6e 67 75 61 67 65 | 4d 6f 64 65 6c 29 20 7b |Language|Model) {|
|00001bc0| 0d 09 09 73 74 61 74 75 | 73 20 3d 20 53 52 52 65 |...statu|s = SRRe|
|00001bd0| 6c 65 61 73 65 4f 62 6a | 65 63 74 20 28 67 54 6f |leaseObj|ect (gTo|
|00001be0| 70 4c 61 6e 67 75 61 67 | 65 4d 6f 64 65 6c 29 3b |pLanguag|eModel);|
|00001bf0| 09 09 09 2f 2a 20 69 67 | 6e 6f 72 65 20 73 74 61 |.../* ig|nore sta|
|00001c00| 74 75 73 20 2a 2f 0d 09 | 09 67 54 6f 70 4c 61 6e |tus */..|.gTopLan|
|00001c10| 67 75 61 67 65 4d 6f 64 | 65 6c 20 3d 20 4e 55 4c |guageMod|el = NUL|
|00001c20| 4c 3b 0d 09 7d 0d 09 0d | 09 2f 2a 20 69 66 20 77 |L;..}...|./* if w|
|00001c30| 65 20 68 61 76 65 20 61 | 20 72 65 63 6f 67 6e 69 |e have a| recogni|
|00001c40| 7a 65 72 2c 20 72 65 6c | 65 61 73 65 20 69 74 20 |zer, rel|ease it |
|00001c50| 2a 2f 0d 09 69 66 20 28 | 67 52 65 63 6f 67 6e 69 |*/..if (|gRecogni|
|00001c60| 7a 65 72 29 20 7b 0d 09 | 09 73 74 61 74 75 73 20 |zer) {..|.status |
|00001c70| 3d 20 53 52 53 74 6f 70 | 4c 69 73 74 65 6e 69 6e |= SRStop|Listenin|
|00001c80| 67 20 28 67 52 65 63 6f | 67 6e 69 7a 65 72 29 3b |g (gReco|gnizer);|
|00001c90| 0d 09 09 73 74 61 74 75 | 73 20 3d 20 53 52 52 65 |...statu|s = SRRe|
|00001ca0| 6c 65 61 73 65 4f 62 6a | 65 63 74 20 28 67 52 65 |leaseObj|ect (gRe|
|00001cb0| 63 6f 67 6e 69 7a 65 72 | 29 3b 0d 09 09 67 52 65 |cognizer|);...gRe|
|00001cc0| 63 6f 67 6e 69 7a 65 72 | 20 3d 20 4e 55 4c 4c 3b |cognizer| = NULL;|
|00001cd0| 0d 09 7d 0d 0d 09 2f 2a | 20 69 66 20 77 65 20 68 |..}.../*| if we h|
|00001ce0| 61 76 65 20 61 20 72 65 | 63 6f 67 6e 69 74 69 6f |ave a re|cognitio|
|00001cf0| 6e 20 73 79 73 74 65 6d | 2c 20 63 6c 6f 73 65 20 |n system|, close |
|00001d00| 69 74 20 2a 2f 0d 09 69 | 66 20 28 67 52 65 63 6f |it */..i|f (gReco|
|00001d10| 67 6e 69 74 69 6f 6e 53 | 79 73 74 65 6d 29 20 7b |gnitionS|ystem) {|
|00001d20| 0d 09 09 73 74 61 74 75 | 73 20 3d 20 53 52 43 6c |...statu|s = SRCl|
|00001d30| 6f 73 65 52 65 63 6f 67 | 6e 69 74 69 6f 6e 53 79 |oseRecog|nitionSy|
|00001d40| 73 74 65 6d 20 28 67 52 | 65 63 6f 67 6e 69 74 69 |stem (gR|ecogniti|
|00001d50| 6f 6e 53 79 73 74 65 6d | 29 3b 0d 09 09 67 52 65 |onSystem|);...gRe|
|00001d60| 63 6f 67 6e 69 74 69 6f | 6e 53 79 73 74 65 6d 20 |cognitio|nSystem |
|00001d70| 3d 20 4e 55 4c 4c 3b 0d | 09 7d 0d 09 0d 09 2f 2a |= NULL;.|.}..../*|
|00001d80| 20 72 65 6d 6f 76 65 20 | 6f 75 72 20 41 70 70 6c | remove |our Appl|
|00001d90| 65 45 76 65 6e 74 20 68 | 61 6e 64 6c 65 72 20 61 |eEvent h|andler a|
|00001da0| 6e 64 20 64 69 73 70 6f | 73 65 20 6f 66 20 74 68 |nd dispo|se of th|
|00001db0| 65 20 68 61 6e 64 6c 65 | 72 27 73 20 72 6f 75 74 |e handle|r's rout|
|00001dc0| 69 6e 65 20 64 65 73 63 | 72 69 70 74 6f 72 20 2a |ine desc|riptor *|
|00001dd0| 2f 0d 09 69 66 20 28 67 | 41 45 52 6f 75 74 69 6e |/..if (g|AERoutin|
|00001de0| 65 44 65 73 63 72 69 70 | 74 6f 72 29 20 7b 0d 09 |eDescrip|tor) {..|
|00001df0| 09 73 74 61 74 75 73 20 | 3d 20 41 45 52 65 6d 6f |.status |= AERemo|
|00001e00| 76 65 45 76 65 6e 74 48 | 61 6e 64 6c 65 72 20 28 |veEventH|andler (|
|00001e10| 6b 41 45 53 70 65 65 63 | 68 53 75 69 74 65 2c 20 |kAESpeec|hSuite, |
|00001e20| 6b 41 45 53 70 65 65 63 | 68 44 6f 6e 65 2c 20 67 |kAESpeec|hDone, g|
|00001e30| 41 45 52 6f 75 74 69 6e | 65 44 65 73 63 72 69 70 |AERoutin|eDescrip|
|00001e40| 74 6f 72 2c 20 66 61 6c | 73 65 29 3b 0d 09 09 44 |tor, fal|se);...D|
|00001e50| 69 73 70 6f 73 65 52 6f | 75 74 69 6e 65 44 65 73 |isposeRo|utineDes|
|00001e60| 63 72 69 70 74 6f 72 20 | 28 67 41 45 52 6f 75 74 |criptor |(gAERout|
|00001e70| 69 6e 65 44 65 73 63 72 | 69 70 74 6f 72 29 3b 0d |ineDescr|iptor);.|
|00001e80| 09 09 67 41 45 52 6f 75 | 74 69 6e 65 44 65 73 63 |..gAERou|tineDesc|
|00001e90| 72 69 70 74 6f 72 20 3d | 20 4e 55 4c 4c 3b 0d 09 |riptor =| NULL;..|
|00001ea0| 7d 0d 0d 09 72 65 74 75 | 72 6e 20 73 74 61 74 75 |}...retu|rn statu|
|00001eb0| 73 3b 0d 7d 0d 0d 2f 2a | 09 42 75 69 6c 64 4c 61 |s;.}../*|.BuildLa|
|00001ec0| 6e 67 75 61 67 65 4d 6f | 64 65 6c 0d 0d 09 41 6c |nguageMo|del...Al|
|00001ed0| 6c 6f 63 61 74 65 73 20 | 61 6e 64 20 62 75 69 6c |locates |and buil|
|00001ee0| 64 73 20 67 54 6f 70 4c | 61 6e 67 75 61 67 65 4d |ds gTopL|anguageM|
|00001ef0| 6f 64 65 6c 20 74 6f 20 | 62 65 0d 09 0d 09 48 65 |odel to |be....He|
|00001f00| 6c 6c 6f 09 09 09 09 6f | 72 0d 09 47 6f 6f 64 62 |llo....o|r..Goodb|
|00001f10| 79 65 09 09 09 09 6f 72 | 0d 09 57 68 61 74 20 74 |ye....or|..What t|
|00001f20| 69 6d 65 20 69 73 20 69 | 74 3f 0d 09 0d 09 55 73 |ime is i|t?....Us|
|00001f30| 69 6e 67 20 74 68 65 20 | 73 69 6d 70 6c 65 73 74 |ing the |simplest|
|00001f40| 20 74 65 63 68 6e 69 71 | 75 65 2c 20 53 52 41 64 | techniq|ue, SRAd|
|00001f50| 64 54 65 78 74 2e 20 20 | 49 74 20 74 68 65 6e 20 |dText. |It then |
|00001f60| 61 75 67 6d 65 6e 74 73 | 20 74 68 69 73 20 73 69 |augments| this si|
|00001f70| 6d 70 6c 65 20 6c 61 6e | 67 75 61 67 65 0d 09 6d |mple lan|guage..m|
|00001f80| 6f 64 65 6c 20 77 69 74 | 68 20 61 20 66 61 6e 63 |odel wit|h a fanc|
|00001f90| 69 65 72 20 6f 6e 65 20 | 62 79 20 63 61 6c 6c 69 |ier one |by calli|
|00001fa0| 6e 67 20 41 64 64 46 61 | 6e 63 69 65 72 4c 61 6e |ng AddFa|ncierLan|
|00001fb0| 67 75 61 67 65 4d 6f 64 | 65 6c 2e 0d 2a 2f 0d 0d |guageMod|el..*/..|
|00001fc0| 4f 53 45 72 72 20 42 75 | 69 6c 64 4c 61 6e 67 75 |OSErr Bu|ildLangu|
|00001fd0| 61 67 65 4d 6f 64 65 6c | 20 28 76 6f 69 64 29 0d |ageModel| (void).|
|00001fe0| 7b 09 0d 09 4f 53 45 72 | 72 09 09 09 73 74 61 74 |{...OSEr|r...stat|
|00001ff0| 75 73 09 09 3d 20 6e 6f | 45 72 72 3b 0d 09 63 6f |us..= no|Err;..co|
|00002000| 6e 73 74 20 63 68 61 72 | 09 09 6b 4c 4d 4e 61 6d |nst char|..kLMNam|
|00002010| 65 5b 5d 09 3d 20 22 3c | 54 6f 70 20 4c 4d 3e 22 |e[].= "<|Top LM>"|
|00002020| 3b 0d 0d 09 2f 2a 20 66 | 69 72 73 74 2c 20 61 6c |;.../* f|irst, al|
|00002030| 6c 6f 63 61 74 65 20 74 | 68 65 20 6c 61 6e 67 75 |locate t|he langu|
|00002040| 61 67 65 20 6d 6f 64 65 | 6c 2c 20 73 74 6f 72 69 |age mode|l, stori|
|00002050| 6e 67 20 69 74 20 69 6e | 20 67 54 6f 70 4c 61 6e |ng it in| gTopLan|
|00002060| 67 75 61 67 65 4d 6f 64 | 65 6c 20 2a 2f 0d 09 73 |guageMod|el */..s|
|00002070| 74 61 74 75 73 20 3d 20 | 53 52 4e 65 77 4c 61 6e |tatus = |SRNewLan|
|00002080| 67 75 61 67 65 4d 6f 64 | 65 6c 20 28 67 52 65 63 |guageMod|el (gRec|
|00002090| 6f 67 6e 69 74 69 6f 6e | 53 79 73 74 65 6d 2c 20 |ognition|System, |
|000020a0| 26 67 54 6f 70 4c 61 6e | 67 75 61 67 65 4d 6f 64 |&gTopLan|guageMod|
|000020b0| 65 6c 2c 20 6b 4c 4d 4e | 61 6d 65 2c 20 73 74 72 |el, kLMN|ame, str|
|000020c0| 6c 65 6e 20 28 6b 4c 4d | 4e 61 6d 65 29 29 3b 0d |len (kLM|Name));.|
|000020d0| 09 0d 09 69 66 20 28 21 | 73 74 61 74 75 73 29 20 |...if (!|status) |
|000020e0| 7b 0d 09 09 6c 6f 6e 67 | 20 72 65 66 63 6f 6e 20 |{...long| refcon |
|000020f0| 3d 20 6b 54 6f 70 4c 4d | 52 65 66 63 6f 6e 3b 0d |= kTopLM|Refcon;.|
|00002100| 09 09 0d 09 09 2f 2a 20 | 73 65 74 20 74 68 65 20 |...../* |set the |
|00002110| 72 65 66 63 6f 6e 20 6f | 66 20 6f 75 72 20 74 6f |refcon o|f our to|
|00002120| 70 20 6c 61 6e 67 75 61 | 67 65 20 6d 6f 64 65 6c |p langua|ge model|
|00002130| 20 73 6f 20 74 68 61 74 | 20 77 68 65 6e 20 77 65 | so that| when we|
|00002140| 20 70 72 6f 63 65 73 73 | 20 6f 75 72 20 72 65 63 | process| our rec|
|00002150| 6f 67 6e 69 74 69 6f 6e | 20 2a 2f 0d 09 09 2f 2a |ognition| */.../*|
|00002160| 20 72 65 73 75 6c 74 20 | 77 65 20 77 69 6c 6c 20 | result |we will |
|00002170| 62 65 20 61 62 6c 65 20 | 74 6f 20 64 69 73 74 69 |be able |to disti|
|00002180| 6e 67 75 69 73 68 20 69 | 74 20 66 72 6f 6d 20 74 |nguish i|t from t|
|00002190| 68 65 20 72 65 6a 65 63 | 74 69 6f 6e 20 77 6f 72 |he rejec|tion wor|
|000021a0| 64 2c 20 22 3f 3f 3f 22 | 20 2a 2f 0d 09 09 73 74 |d, "???"| */...st|
|000021b0| 61 74 75 73 20 3d 20 53 | 52 53 65 74 50 72 6f 70 |atus = S|RSetProp|
|000021c0| 65 72 74 79 20 28 67 54 | 6f 70 4c 61 6e 67 75 61 |erty (gT|opLangua|
|000021d0| 67 65 4d 6f 64 65 6c 2c | 20 6b 53 52 52 65 66 43 |geModel,| kSRRefC|
|000021e0| 6f 6e 2c 20 26 72 65 66 | 63 6f 6e 2c 20 73 69 7a |on, &ref|con, siz|
|000021f0| 65 6f 66 20 28 72 65 66 | 63 6f 6e 29 29 3b 0d 0d |eof (ref|con));..|
|00002200| 09 09 69 66 20 28 21 73 | 74 61 74 75 73 29 20 7b |..if (!s|tatus) {|
|00002210| 0d 09 09 09 63 6f 6e 73 | 74 20 63 68 61 72 09 2a |....cons|t char.*|
|00002220| 6b 53 69 6d 70 6c 65 53 | 74 72 5b 5d 09 3d 20 7b |kSimpleS|tr[].= {|
|00002230| 20 22 48 65 6c 6c 6f 22 | 2c 20 22 47 6f 6f 64 62 | "Hello"|, "Goodb|
|00002240| 79 65 22 2c 20 22 57 68 | 61 74 20 74 69 6d 65 20 |ye", "Wh|at time |
|00002250| 69 73 20 69 74 3f 22 2c | 20 4e 55 4c 4c 20 7d 3b |is it?",| NULL };|
|00002260| 0d 09 09 09 63 68 61 72 | 20 09 09 2a 2a 63 75 72 |....char| ..**cur|
|00002270| 72 65 6e 74 53 74 72 20 | 09 3d 20 28 63 68 61 72 |rentStr |.= (char|
|00002280| 20 2a 2a 29 20 6b 53 69 | 6d 70 6c 65 53 74 72 3b | **) kSi|mpleStr;|
|00002290| 0d 09 09 09 6c 6f 6e 67 | 09 09 72 65 66 63 6f 6e |....long|..refcon|
|000022a0| 20 09 09 09 3d 20 6b 48 | 65 6c 6c 6f 52 65 66 43 | ...= kH|elloRefC|
|000022b0| 6f 6e 3b 0d 09 09 09 0d | 09 09 09 2f 2a 20 41 64 |on;.....|.../* Ad|
|000022c0| 64 20 65 61 63 68 20 6f | 66 20 74 68 65 20 73 74 |d each o|f the st|
|000022d0| 72 69 6e 67 73 20 69 6e | 20 6b 53 69 6d 70 6c 65 |rings in| kSimple|
|000022e0| 53 74 72 20 74 6f 20 74 | 68 65 20 6c 61 6e 67 75 |Str to t|he langu|
|000022f0| 61 67 65 20 6d 6f 64 65 | 6c 2c 20 61 6e 64 20 73 |age mode|l, and s|
|00002300| 65 74 20 74 68 65 20 72 | 65 66 63 6f 6e 20 74 6f |et the r|efcon to|
|00002310| 20 2a 2f 0d 09 09 09 2f | 2a 20 74 68 65 20 69 6e | */..../|* the in|
|00002320| 64 65 78 20 6f 66 20 74 | 68 65 20 73 74 72 69 6e |dex of t|he strin|
|00002330| 67 20 69 6e 20 74 68 65 | 20 6b 53 69 6d 70 6c 65 |g in the| kSimple|
|00002340| 53 74 72 20 61 72 72 61 | 79 2e 20 4e 6f 74 65 20 |Str arra|y. Note |
|00002350| 74 68 61 74 20 53 52 41 | 64 64 54 65 78 74 20 69 |that SRA|ddText i|
|00002360| 73 20 61 20 73 68 6f 72 | 74 63 75 74 20 2a 2f 0d |s a shor|tcut */.|
|00002370| 09 09 09 2f 2a 20 66 6f | 72 20 63 61 6c 6c 69 6e |.../* fo|r callin|
|00002380| 67 20 53 52 4e 65 77 50 | 68 72 61 73 65 2c 20 53 |g SRNewP|hrase, S|
|00002390| 52 41 64 64 4c 61 6e 67 | 75 61 67 65 4f 62 6a 65 |RAddLang|uageObje|
|000023a0| 63 74 2c 20 61 6e 64 20 | 53 52 52 65 6c 65 61 73 |ct, and |SRReleas|
|000023b0| 65 4f 62 6a 65 63 74 20 | 69 6e 20 73 75 63 63 65 |eObject |in succe|
|000023c0| 73 73 69 6f 6e 20 2a 2f | 0d 09 09 09 0d 09 09 09 |ssion */|........|
|000023d0| 77 68 69 6c 65 20 28 2a | 63 75 72 72 65 6e 74 53 |while (*|currentS|
|000023e0| 74 72 20 26 26 20 21 73 | 74 61 74 75 73 29 20 7b |tr && !s|tatus) {|
|000023f0| 0d 09 09 09 09 73 74 61 | 74 75 73 20 3d 20 53 52 |.....sta|tus = SR|
|00002400| 41 64 64 54 65 78 74 20 | 28 67 54 6f 70 4c 61 6e |AddText |(gTopLan|
|00002410| 67 75 61 67 65 4d 6f 64 | 65 6c 2c 20 2a 63 75 72 |guageMod|el, *cur|
|00002420| 72 65 6e 74 53 74 72 2c | 20 73 74 72 6c 65 6e 20 |rentStr,| strlen |
|00002430| 28 2a 63 75 72 72 65 6e | 74 53 74 72 29 2c 20 72 |(*curren|tStr), r|
|00002440| 65 66 63 6f 6e 2b 2b 29 | 3b 0d 09 09 09 09 2b 2b |efcon++)|;.....++|
|00002450| 63 75 72 72 65 6e 74 53 | 74 72 3b 0d 09 09 09 7d |currentS|tr;....}|
|00002460| 0d 09 09 09 0d 09 09 09 | 2f 2a 20 6e 6f 77 20 61 |........|/* now a|
|00002470| 75 67 6d 65 6e 74 20 74 | 68 69 73 20 73 69 6d 70 |ugment t|his simp|
|00002480| 6c 65 20 6c 61 6e 67 75 | 61 67 65 20 6d 6f 64 65 |le langu|age mode|
|00002490| 6c 20 77 69 74 68 20 61 | 20 66 61 6e 63 69 65 72 |l with a| fancier|
|000024a0| 20 6f 6e 65 20 2a 2f 0d | 09 09 09 69 66 20 28 21 | one */.|...if (!|
|000024b0| 73 74 61 74 75 73 29 0d | 09 09 09 09 73 74 61 74 |status).|....stat|
|000024c0| 75 73 20 3d 20 41 64 64 | 46 61 6e 63 69 65 72 4c |us = Add|FancierL|
|000024d0| 61 6e 67 75 61 67 65 4d | 6f 64 65 6c 20 28 67 54 |anguageM|odel (gT|
|000024e0| 6f 70 4c 61 6e 67 75 61 | 67 65 4d 6f 64 65 6c 29 |opLangua|geModel)|
|000024f0| 3b 0d 09 09 7d 0d 09 7d | 0d 09 0d 09 72 65 74 75 |;...}..}|....retu|
|00002500| 72 6e 20 73 74 61 74 75 | 73 3b 0d 7d 0d 0d 2f 2a |rn statu|s;.}../*|
|00002510| 09 41 64 64 46 61 6e 63 | 69 65 72 4c 61 6e 67 75 |.AddFanc|ierLangu|
|00002520| 61 67 65 4d 6f 64 65 6c | 0d 0d 09 41 75 67 6d 65 |ageModel|...Augme|
|00002530| 6e 74 20 74 68 65 20 6c | 61 6e 67 75 61 67 65 20 |nt the l|anguage |
|00002540| 6d 6f 64 65 6c 20 62 75 | 69 6c 74 20 69 6e 20 42 |model bu|ilt in B|
|00002550| 75 69 6c 64 53 69 6d 70 | 6c 65 4c 61 6e 67 75 61 |uildSimp|leLangua|
|00002560| 67 65 4d 6f 64 65 6c 20 | 74 6f 20 68 61 76 65 20 |geModel |to have |
|00002570| 61 20 66 6f 75 72 74 68 | 0d 09 70 68 72 61 73 65 |a fourth|..phrase|
|00002580| 20 77 68 69 63 68 20 69 | 6e 63 6c 75 64 65 73 20 | which i|ncludes |
|00002590| 61 6e 20 65 6d 62 65 64 | 64 65 64 20 6c 61 6e 67 |an embed|ded lang|
|000025a0| 75 61 67 65 20 6d 6f 64 | 65 6c 20 61 6e 64 20 61 |uage mod|el and a|
|000025b0| 6e 20 6f 70 74 69 6f 6e | 61 6c 20 77 6f 72 64 3a |n option|al word:|
|000025c0| 0d 0d 09 09 54 65 6c 6c | 20 6d 65 20 74 68 65 20 |....Tell| me the |
|000025d0| 70 72 69 63 65 20 6f 66 | 20 3c 63 6f 6d 70 61 6e |price of| <compan|
|000025e0| 79 3e 20 5b 73 74 6f 63 | 6b 5d 0d 0d 09 77 68 65 |y> [stoc|k]...whe|
|000025f0| 72 65 0d 0d 09 09 3c 63 | 6f 6d 70 61 6e 79 3e 20 |re....<c|ompany> |
|00002600| 3d 20 41 70 70 6c 65 20 | 7c 20 4e 65 74 73 63 61 |= Apple || Netsca|
|00002610| 70 65 20 7c 20 43 6f 63 | 61 20 43 6f 6c 61 0d 09 |pe | Coc|a Cola..|
|00002620| 0d 09 69 73 20 74 68 65 | 20 65 6d 62 65 64 64 65 |..is the| embedde|
|00002630| 64 20 6c 61 6e 67 75 61 | 67 65 20 6d 6f 64 65 6c |d langua|ge model|
|00002640| 20 61 6e 64 20 5b 73 74 | 6f 63 6b 5d 20 69 6e 64 | and [st|ock] ind|
|00002650| 69 63 61 74 65 73 20 74 | 68 61 74 20 74 68 65 20 |icates t|hat the |
|00002660| 77 6f 72 64 20 27 73 74 | 6f 63 6b 27 20 0d 09 69 |word 'st|ock' ..i|
|00002670| 73 20 6f 70 74 69 6f 6e | 61 6c 2e 0d 2a 2f 0d 0d |s option|al..*/..|
|00002680| 4f 53 45 72 72 20 41 64 | 64 46 61 6e 63 69 65 72 |OSErr Ad|dFancier|
|00002690| 4c 61 6e 67 75 61 67 65 | 4d 6f 64 65 6c 20 28 53 |Language|Model (S|
|000026a0| 52 4c 61 6e 67 75 61 67 | 65 4d 6f 64 65 6c 20 62 |RLanguag|eModel b|
|000026b0| 61 73 65 4c 4d 29 0d 7b | 0d 09 4f 53 45 72 72 20 |aseLM).{|..OSErr |
|000026c0| 73 74 61 74 75 73 20 3d | 20 6e 6f 45 72 72 3b 0d |status =| noErr;.|
|000026d0| 09 0d 09 2f 2a 09 46 69 | 72 73 74 20 63 72 65 61 |.../*.Fi|rst crea|
|000026e0| 74 65 20 61 20 6e 65 77 | 20 53 52 50 61 74 68 2c |te a new| SRPath,|
|000026f0| 20 74 6f 20 77 68 69 63 | 68 20 77 65 20 77 69 6c | to whic|h we wil|
|00002700| 6c 20 61 64 64 20 74 68 | 65 20 70 68 72 61 73 65 |l add th|e phrase|
|00002710| 20 22 54 65 6c 6c 20 6d | 65 20 74 68 65 20 70 72 | "Tell m|e the pr|
|00002720| 69 63 65 20 6f 66 22 20 | 2a 2f 0d 09 2f 2a 09 74 |ice of" |*/../*.t|
|00002730| 68 65 20 6c 61 6e 67 75 | 61 67 65 20 6d 6f 64 65 |he langu|age mode|
|00002740| 6c 20 22 3c 63 6f 6d 70 | 61 6e 79 3e 22 20 61 6e |l "<comp|any>" an|
|00002750| 64 20 74 68 65 20 77 6f | 72 64 20 22 73 74 6f 63 |d the wo|rd "stoc|
|00002760| 6b 22 2e 20 20 57 65 27 | 6c 6c 20 74 68 65 6e 20 |k". We'|ll then |
|00002770| 61 64 64 20 74 68 69 73 | 20 70 61 74 68 20 74 6f |add this| path to|
|00002780| 20 2a 2f 0d 09 2f 2a 09 | 74 68 65 20 62 61 73 65 | */../*.|the base|
|00002790| 4c 4d 20 2a 2f 0d 0d 09 | 53 52 50 61 74 68 20 73 |LM */...|SRPath s|
|000027a0| 74 6f 63 6b 50 61 74 68 | 3b 0d 09 0d 09 73 74 61 |tockPath|;....sta|
|000027b0| 74 75 73 20 3d 20 53 52 | 4e 65 77 50 61 74 68 20 |tus = SR|NewPath |
|000027c0| 28 67 52 65 63 6f 67 6e | 69 74 69 6f 6e 53 79 73 |(gRecogn|itionSys|
|000027d0| 74 65 6d 2c 20 26 73 74 | 6f 63 6b 50 61 74 68 29 |tem, &st|ockPath)|
|000027e0| 3b 0d 09 0d 09 69 66 20 | 28 21 73 74 61 74 75 73 |;....if |(!status|
|000027f0| 29 20 7b 0d 09 09 63 6f | 6e 73 74 20 63 68 61 72 |) {...co|nst char|
|00002800| 09 09 6b 57 68 61 74 53 | 74 72 69 6e 67 5b 5d 09 |..kWhatS|tring[].|
|00002810| 3d 20 22 54 65 6c 6c 20 | 6d 65 20 74 68 65 20 70 |= "Tell |me the p|
|00002820| 72 69 63 65 20 6f 66 22 | 3b 0d 09 09 53 52 50 68 |rice of"|;...SRPh|
|00002830| 72 61 73 65 20 09 09 77 | 68 61 74 50 68 72 61 73 |rase ..w|hatPhras|
|00002840| 65 09 09 3d 20 4e 55 4c | 4c 3b 0d 09 09 53 52 4c |e..= NUL|L;...SRL|
|00002850| 61 6e 67 75 61 67 65 4d | 6f 64 65 6c 09 63 6f 6d |anguageM|odel.com|
|00002860| 70 61 6e 79 4c 4d 09 09 | 3d 20 4e 55 4c 4c 3b 0d |panyLM..|= NULL;.|
|00002870| 09 09 53 52 57 6f 72 64 | 20 09 09 09 73 74 6f 63 |..SRWord| ...stoc|
|00002880| 6b 57 6f 72 64 09 09 3d | 20 4e 55 4c 4c 3b 0d 09 |kWord..=| NULL;..|
|00002890| 09 6c 6f 6e 67 09 09 09 | 72 65 66 63 6f 6e 09 09 |.long...|refcon..|
|000028a0| 09 3d 20 6b 43 6f 6d 70 | 61 6e 79 52 65 66 43 6f |.= kComp|anyRefCo|
|000028b0| 6e 3b 0d 0d 09 09 2f 2a | 20 73 65 74 20 74 68 65 |n;..../*| set the|
|000028c0| 20 72 65 66 63 6f 6e 20 | 6e 6f 77 20 74 6f 20 68 | refcon |now to h|
|000028d0| 65 6c 70 20 75 73 20 64 | 69 73 74 69 6e 67 75 69 |elp us d|istingui|
|000028e0| 73 68 20 77 68 61 74 20 | 77 61 73 20 73 61 69 64 |sh what |was said|
|000028f0| 20 6c 61 74 65 72 20 2a | 2f 09 09 0d 09 09 73 74 | later *|/.....st|
|00002900| 61 74 75 73 20 3d 20 53 | 52 53 65 74 50 72 6f 70 |atus = S|RSetProp|
|00002910| 65 72 74 79 20 28 73 74 | 6f 63 6b 50 61 74 68 2c |erty (st|ockPath,|
|00002920| 20 6b 53 52 52 65 66 43 | 6f 6e 2c 20 26 72 65 66 | kSRRefC|on, &ref|
|00002930| 63 6f 6e 2c 20 73 69 7a | 65 6f 66 20 28 72 65 66 |con, siz|eof (ref|
|00002940| 63 6f 6e 29 29 3b 0d 09 | 09 0d 09 09 69 66 20 28 |con));..|....if (|
|00002950| 21 73 74 61 74 75 73 29 | 20 7b 0d 09 09 09 2f 2a |!status)| {..../*|
|00002960| 20 61 6c 6c 6f 63 61 74 | 65 20 74 68 65 20 70 68 | allocat|e the ph|
|00002970| 72 61 73 65 20 22 54 65 | 6c 6c 20 6d 65 20 74 68 |rase "Te|ll me th|
|00002980| 65 20 70 72 69 63 65 20 | 6f 66 22 20 2a 2f 0d 09 |e price |of" */..|
|00002990| 09 09 73 74 61 74 75 73 | 20 3d 20 53 52 4e 65 77 |..status| = SRNew|
|000029a0| 50 68 72 61 73 65 20 28 | 67 52 65 63 6f 67 6e 69 |Phrase (|gRecogni|
|000029b0| 74 69 6f 6e 53 79 73 74 | 65 6d 2c 20 26 77 68 61 |tionSyst|em, &wha|
|000029c0| 74 50 68 72 61 73 65 2c | 20 6b 57 68 61 74 53 74 |tPhrase,| kWhatSt|
|000029d0| 72 69 6e 67 2c 20 73 74 | 72 6c 65 6e 20 28 6b 57 |ring, st|rlen (kW|
|000029e0| 68 61 74 53 74 72 69 6e | 67 29 29 3b 0d 0d 09 09 |hatStrin|g));....|
|000029f0| 09 2f 2a 20 61 64 64 20 | 74 68 65 20 77 68 61 74 |./* add |the what|
|00002a00| 50 68 72 61 73 65 20 74 | 6f 20 74 68 65 20 73 74 |Phrase t|o the st|
|00002a10| 6f 63 6b 50 61 74 68 20 | 2a 2f 09 09 0d 09 09 09 |ockPath |*/......|
|00002a20| 69 66 20 28 21 73 74 61 | 74 75 73 29 20 7b 0d 09 |if (!sta|tus) {..|
|00002a30| 09 09 09 73 74 61 74 75 | 73 20 3d 20 53 52 41 64 |...statu|s = SRAd|
|00002a40| 64 4c 61 6e 67 75 61 67 | 65 4f 62 6a 65 63 74 20 |dLanguag|eObject |
|00002a50| 28 73 74 6f 63 6b 50 61 | 74 68 2c 20 77 68 61 74 |(stockPa|th, what|
|00002a60| 50 68 72 61 73 65 29 3b | 0d 09 09 09 09 0d 09 09 |Phrase);|........|
|00002a70| 09 09 2f 2a 20 6f 6e 63 | 65 20 61 64 64 65 64 2c |../* onc|e added,|
|00002a80| 20 74 68 65 20 73 74 6f | 63 6b 50 61 74 68 20 72 | the sto|ckPath r|
|00002a90| 65 74 61 69 6e 73 20 61 | 20 72 65 66 65 72 65 6e |etains a| referen|
|00002aa0| 63 65 20 74 6f 20 74 68 | 65 20 77 68 61 74 50 68 |ce to th|e whatPh|
|00002ab0| 72 61 73 65 20 2a 2f 0d | 09 09 09 09 2f 2a 20 73 |rase */.|..../* s|
|00002ac0| 6f 20 77 65 20 63 61 6e | 20 72 65 6c 65 61 73 65 |o we can| release|
|00002ad0| 20 74 68 65 20 77 68 61 | 74 50 68 72 61 73 65 20 | the wha|tPhrase |
|00002ae0| 6e 6f 77 20 2a 2f 0d 09 | 09 09 09 69 66 20 28 21 |now */..|...if (!|
|00002af0| 73 74 61 74 75 73 29 20 | 7b 0d 09 09 09 09 09 73 |status) |{......s|
|00002b00| 74 61 74 75 73 20 3d 20 | 53 52 52 65 6c 65 61 73 |tatus = |SRReleas|
|00002b10| 65 4f 62 6a 65 63 74 20 | 28 77 68 61 74 50 68 72 |eObject |(whatPhr|
|00002b20| 61 73 65 29 3b 0d 09 09 | 09 09 09 77 68 61 74 50 |ase);...|...whatP|
|00002b30| 68 72 61 73 65 20 3d 20 | 4e 55 4c 4c 3b 0d 09 09 |hrase = |NULL;...|
|00002b40| 09 09 7d 0d 09 09 09 7d | 0d 09 09 7d 0d 09 09 0d |..}....}|...}....|
|00002b50| 09 09 2f 2a 20 63 72 65 | 61 74 65 20 74 68 65 20 |../* cre|ate the |
|00002b60| 65 6d 62 65 64 64 65 64 | 20 6c 61 6e 67 75 61 67 |embedded| languag|
|00002b70| 65 20 6d 6f 64 65 6c 20 | 3c 63 6f 6d 70 61 6e 79 |e model |<company|
|00002b80| 3e 20 61 6e 64 20 61 64 | 64 20 69 74 20 74 6f 20 |> and ad|d it to |
|00002b90| 74 68 65 20 73 74 6f 63 | 6b 50 61 74 68 20 2a 2f |the stoc|kPath */|
|00002ba0| 0d 09 09 69 66 20 28 21 | 73 74 61 74 75 73 29 20 |...if (!|status) |
|00002bb0| 7b 0d 09 09 09 63 6f 6e | 73 74 20 63 68 61 72 09 |{....con|st char.|
|00002bc0| 09 6b 43 6f 6d 70 61 6e | 79 4c 4d 4e 61 6d 65 5b |.kCompan|yLMName[|
|00002bd0| 5d 20 3d 20 22 3c 63 6f | 6d 70 61 6e 79 20 4c 4d |] = "<co|mpany LM|
|00002be0| 3e 22 3b 0d 09 09 09 0d | 09 09 09 2f 2a 20 61 6c |>";.....|.../* al|
|00002bf0| 6c 6f 63 61 74 65 20 74 | 68 65 20 65 6d 62 65 64 |locate t|he embed|
|00002c00| 64 65 64 20 6c 61 6e 67 | 75 61 67 65 20 6d 6f 64 |ded lang|uage mod|
|00002c10| 65 6c 20 27 3c 63 6f 6d | 70 61 6e 79 3e 27 20 2a |el '<com|pany>' *|
|00002c20| 2f 0d 09 09 09 73 74 61 | 74 75 73 20 3d 20 53 52 |/....sta|tus = SR|
|00002c30| 4e 65 77 4c 61 6e 67 75 | 61 67 65 4d 6f 64 65 6c |NewLangu|ageModel|
|00002c40| 20 28 67 52 65 63 6f 67 | 6e 69 74 69 6f 6e 53 79 | (gRecog|nitionSy|
|00002c50| 73 74 65 6d 2c 20 26 63 | 6f 6d 70 61 6e 79 4c 4d |stem, &c|ompanyLM|
|00002c60| 2c 20 6b 43 6f 6d 70 61 | 6e 79 4c 4d 4e 61 6d 65 |, kCompa|nyLMName|
|00002c70| 2c 20 73 74 72 6c 65 6e | 20 28 6b 43 6f 6d 70 61 |, strlen| (kCompa|
|00002c80| 6e 79 4c 4d 4e 61 6d 65 | 29 29 3b 0d 09 09 09 0d |nyLMName|));.....|
|00002c90| 09 09 09 69 66 20 28 21 | 73 74 61 74 75 73 29 20 |...if (!|status) |
|00002ca0| 7b 0d 09 09 09 09 63 6f | 6e 73 74 20 63 68 61 72 |{.....co|nst char|
|00002cb0| 09 09 2a 6b 43 6f 6d 70 | 61 6e 79 4e 61 6d 65 73 |..*kComp|anyNames|
|00002cc0| 5b 5d 20 3d 20 7b 20 22 | 41 70 70 6c 65 22 2c 20 |[] = { "|Apple", |
|00002cd0| 22 4e 65 74 73 63 61 70 | 65 22 2c 20 22 50 65 70 |"Netscap|e", "Pep|
|00002ce0| 73 69 22 2c 20 4e 55 4c | 4c 20 7d 3b 0d 09 09 09 |si", NUL|L };....|
|00002cf0| 09 63 68 61 72 09 09 09 | 2a 2a 63 6f 6d 70 61 6e |.char...|**compan|
|00002d00| 79 4e 61 6d 65 20 3d 20 | 28 63 68 61 72 20 2a 2a |yName = |(char **|
|00002d10| 29 20 6b 43 6f 6d 70 61 | 6e 79 4e 61 6d 65 73 3b |) kCompa|nyNames;|
|00002d20| 0d 09 09 09 09 6c 6f 6e | 67 09 09 09 72 65 66 63 |.....lon|g...refc|
|00002d30| 6f 6e 20 3d 20 6b 41 70 | 70 6c 65 52 65 66 43 6f |on = kAp|pleRefCo|
|00002d40| 6e 3b 0d 09 09 09 09 0d | 09 09 09 09 2f 2a 20 61 |n;......|..../* a|
|00002d50| 64 64 20 74 68 65 20 63 | 6f 6d 70 6e 61 79 20 6e |dd the c|ompnay n|
|00002d60| 61 6d 65 73 20 74 6f 20 | 74 68 65 20 6c 61 6e 67 |ames to |the lang|
|00002d70| 75 61 67 65 20 6d 6f 64 | 65 6c 20 27 3c 63 6f 6d |uage mod|el '<com|
|00002d80| 70 61 6e 79 3e 27 20 2a | 2f 0d 09 09 09 09 77 68 |pany>' *|/.....wh|
|00002d90| 69 6c 65 20 28 2a 63 6f | 6d 70 61 6e 79 4e 61 6d |ile (*co|mpanyNam|
|00002da0| 65 20 26 26 20 21 73 74 | 61 74 75 73 29 20 7b 0d |e && !st|atus) {.|
|00002db0| 09 09 09 09 09 73 74 61 | 74 75 73 20 3d 20 53 52 |.....sta|tus = SR|
|00002dc0| 41 64 64 54 65 78 74 20 | 28 63 6f 6d 70 61 6e 79 |AddText |(company|
|00002dd0| 4c 4d 2c 20 2a 63 6f 6d | 70 61 6e 79 4e 61 6d 65 |LM, *com|panyName|
|00002de0| 2c 20 73 74 72 6c 65 6e | 20 28 2a 63 6f 6d 70 61 |, strlen| (*compa|
|00002df0| 6e 79 4e 61 6d 65 29 2c | 20 72 65 66 63 6f 6e 2b |nyName),| refcon+|
|00002e00| 2b 29 3b 0d 09 09 09 09 | 09 2b 2b 63 6f 6d 70 61 |+);.....|.++compa|
|00002e10| 6e 79 4e 61 6d 65 3b 0d | 09 09 09 09 7d 0d 09 09 |nyName;.|....}...|
|00002e20| 09 09 0d 09 09 09 09 2f | 2a 20 61 64 64 20 74 68 |......./|* add th|
|00002e30| 65 20 63 6f 6d 70 61 6e | 79 20 6c 61 6e 67 75 61 |e compan|y langua|
|00002e40| 67 65 20 6d 6f 64 65 6c | 20 74 6f 20 74 68 65 20 |ge model| to the |
|00002e50| 73 74 6f 63 6b 50 61 74 | 68 2e 2e 2e 20 2a 2f 0d |stockPat|h... */.|
|00002e60| 09 09 09 09 69 66 20 28 | 21 73 74 61 74 75 73 29 |....if (|!status)|
|00002e70| 20 7b 0d 09 09 09 09 09 | 73 74 61 74 75 73 20 3d | {......|status =|
|00002e80| 20 53 52 41 64 64 4c 61 | 6e 67 75 61 67 65 4f 62 | SRAddLa|nguageOb|
|00002e90| 6a 65 63 74 20 28 73 74 | 6f 63 6b 50 61 74 68 2c |ject (st|ockPath,|
|00002ea0| 20 63 6f 6d 70 61 6e 79 | 4c 4d 29 3b 0d 09 09 09 | company|LM);....|
|00002eb0| 09 09 0d 09 09 09 09 09 | 2f 2a 20 2e 2e 2e 20 61 |........|/* ... a|
|00002ec0| 6e 64 20 72 65 6c 65 61 | 73 65 20 69 74 20 73 69 |nd relea|se it si|
|00002ed0| 6e 63 65 20 69 74 20 69 | 73 20 6e 6f 77 20 27 6f |nce it i|s now 'o|
|00002ee0| 77 6e 65 64 27 20 62 79 | 20 74 68 65 20 73 74 6f |wned' by| the sto|
|00002ef0| 63 6b 50 61 74 68 20 2a | 2f 0d 09 09 09 09 09 69 |ckPath *|/......i|
|00002f00| 66 20 28 21 73 74 61 74 | 75 73 29 20 7b 0d 09 09 |f (!stat|us) {...|
|00002f10| 09 09 09 09 73 74 61 74 | 75 73 20 3d 20 53 52 52 |....stat|us = SRR|
|00002f20| 65 6c 65 61 73 65 4f 62 | 6a 65 63 74 20 28 63 6f |eleaseOb|ject (co|
|00002f30| 6d 70 61 6e 79 4c 4d 29 | 3b 0d 09 09 09 09 09 09 |mpanyLM)|;.......|
|00002f40| 63 6f 6d 70 61 6e 79 4c | 4d 20 3d 20 4e 55 4c 4c |companyL|M = NULL|
|00002f50| 3b 0d 09 09 09 09 09 7d | 0d 09 09 09 09 7d 0d 09 |;......}|.....}..|
|00002f60| 09 09 7d 0d 09 09 7d 0d | 09 09 0d 09 09 2f 2a 20 |..}...}.|...../* |
|00002f70| 63 72 65 61 74 65 20 74 | 68 65 20 77 6f 72 64 20 |create t|he word |
|00002f80| 27 73 74 6f 63 6b 27 2c | 20 6d 61 6b 65 20 69 74 |'stock',| make it|
|00002f90| 20 6f 70 74 69 6f 6e 61 | 6c 20 61 6e 64 20 61 64 | optiona|l and ad|
|00002fa0| 64 20 69 74 20 74 6f 20 | 74 68 65 20 73 74 6f 63 |d it to |the stoc|
|00002fb0| 6b 50 61 74 68 20 2a 2f | 0d 09 09 69 66 20 28 21 |kPath */|...if (!|
|00002fc0| 73 74 61 74 75 73 29 20 | 7b 0d 09 09 09 63 6f 6e |status) |{....con|
|00002fd0| 73 74 20 63 68 61 72 09 | 6b 53 74 6f 63 6b 57 6f |st char.|kStockWo|
|00002fe0| 72 64 5b 5d 20 3d 20 22 | 73 74 6f 63 6b 22 3b 0d |rd[] = "|stock";.|
|00002ff0| 09 09 09 0d 09 09 09 2f | 2a 20 61 6c 6c 6f 63 61 |......./|* alloca|
|00003000| 74 65 64 20 74 68 65 20 | 77 6f 72 64 20 2a 2f 0d |ted the |word */.|
|00003010| 09 09 09 73 74 61 74 75 | 73 20 3d 20 53 52 4e 65 |...statu|s = SRNe|
|00003020| 77 57 6f 72 64 20 28 67 | 52 65 63 6f 67 6e 69 74 |wWord (g|Recognit|
|00003030| 69 6f 6e 53 79 73 74 65 | 6d 2c 20 26 73 74 6f 63 |ionSyste|m, &stoc|
|00003040| 6b 57 6f 72 64 2c 20 6b | 53 74 6f 63 6b 57 6f 72 |kWord, k|StockWor|
|00003050| 64 2c 20 73 74 72 6c 65 | 6e 20 28 6b 53 74 6f 63 |d, strle|n (kStoc|
|00003060| 6b 57 6f 72 64 29 29 3b | 0d 09 09 09 0d 09 09 09 |kWord));|........|
|00003070| 69 66 20 28 21 73 74 61 | 74 75 73 29 20 7b 0d 09 |if (!sta|tus) {..|
|00003080| 09 09 09 42 6f 6f 6c 65 | 61 6e 20 77 61 6e 74 4f |...Boole|an wantO|
|00003090| 70 74 69 6f 6e 61 6c 20 | 3d 20 74 72 75 65 3b 0d |ptional |= true;.|
|000030a0| 09 09 09 09 0d 09 09 09 | 09 2f 2a 20 6d 61 6b 65 |........|./* make|
|000030b0| 20 69 74 20 6f 70 74 69 | 6f 6e 61 6c 20 62 79 20 | it opti|onal by |
|000030c0| 73 65 74 74 69 6e 67 20 | 69 74 27 73 20 6b 53 52 |setting |it's kSR|
|000030d0| 4f 70 74 69 6f 6e 61 6c | 20 70 72 6f 70 65 72 74 |Optional| propert|
|000030e0| 79 20 74 6f 20 74 72 75 | 65 20 2a 2f 0d 09 09 09 |y to tru|e */....|
|000030f0| 09 73 74 61 74 75 73 20 | 3d 20 53 52 53 65 74 50 |.status |= SRSetP|
|00003100| 72 6f 70 65 72 74 79 20 | 28 73 74 6f 63 6b 57 6f |roperty |(stockWo|
|00003110| 72 64 2c 20 6b 53 52 4f | 70 74 69 6f 6e 61 6c 2c |rd, kSRO|ptional,|
|00003120| 20 26 77 61 6e 74 4f 70 | 74 69 6f 6e 61 6c 2c 20 | &wantOp|tional, |
|00003130| 73 69 7a 65 6f 66 20 28 | 77 61 6e 74 4f 70 74 69 |sizeof (|wantOpti|
|00003140| 6f 6e 61 6c 29 29 3b 0d | 0d 09 09 09 09 2f 2a 20 |onal));.|...../* |
|00003150| 61 64 64 20 69 74 20 74 | 6f 20 74 68 65 20 73 74 |add it t|o the st|
|00003160| 6f 63 6b 50 61 74 68 20 | 2a 2f 09 09 09 09 0d 09 |ockPath |*/......|
|00003170| 09 09 09 69 66 20 28 21 | 73 74 61 74 75 73 29 20 |...if (!|status) |
|00003180| 7b 0d 09 09 09 09 09 73 | 74 61 74 75 73 20 3d 20 |{......s|tatus = |
|00003190| 53 52 41 64 64 4c 61 6e | 67 75 61 67 65 4f 62 6a |SRAddLan|guageObj|
|000031a0| 65 63 74 20 28 73 74 6f | 63 6b 50 61 74 68 2c 20 |ect (sto|ckPath, |
|000031b0| 73 74 6f 63 6b 57 6f 72 | 64 29 3b 0d 09 09 09 09 |stockWor|d);.....|
|000031c0| 09 0d 09 09 09 09 09 2f | 2a 20 2e 2e 2e 20 61 6e |......./|* ... an|
|000031d0| 64 20 72 65 6c 65 61 73 | 65 20 6f 75 72 20 72 65 |d releas|e our re|
|000031e0| 66 65 72 65 6e 63 65 20 | 74 6f 20 69 74 20 2a 2f |ference |to it */|
|000031f0| 0d 09 09 09 09 09 69 66 | 20 28 21 73 74 61 74 75 |......if| (!statu|
|00003200| 73 29 20 7b 0d 09 09 09 | 09 09 09 73 74 61 74 75 |s) {....|...statu|
|00003210| 73 20 3d 20 53 52 52 65 | 6c 65 61 73 65 4f 62 6a |s = SRRe|leaseObj|
|00003220| 65 63 74 20 28 73 74 6f | 63 6b 57 6f 72 64 29 3b |ect (sto|ckWord);|
|00003230| 0d 09 09 09 09 09 09 73 | 74 6f 63 6b 57 6f 72 64 |.......s|tockWord|
|00003240| 20 3d 20 4e 55 4c 4c 3b | 0d 09 09 09 09 09 7d 0d | = NULL;|......}.|
|00003250| 09 09 09 09 7d 0d 09 09 | 09 7d 0d 09 09 7d 0d 09 |....}...|.}...}..|
|00003260| 09 0d 09 09 0d 09 09 2f | 2a 20 61 64 64 20 74 68 |......./|* add th|
|00003270| 65 20 73 74 6f 63 6b 20 | 70 61 74 68 20 74 6f 20 |e stock |path to |
|00003280| 74 68 65 20 62 61 73 65 | 4c 4d 20 61 6e 64 20 77 |the base|LM and w|
|00003290| 65 27 72 65 20 64 6f 6e | 65 20 2a 2f 0d 09 09 69 |e're don|e */...i|
|000032a0| 66 20 28 21 73 74 61 74 | 75 73 29 20 7b 0d 09 09 |f (!stat|us) {...|
|000032b0| 09 73 74 61 74 75 73 20 | 3d 20 53 52 41 64 64 4c |.status |= SRAddL|
|000032c0| 61 6e 67 75 61 67 65 4f | 62 6a 65 63 74 20 28 62 |anguageO|bject (b|
|000032d0| 61 73 65 4c 4d 2c 20 73 | 74 6f 63 6b 50 61 74 68 |aseLM, s|tockPath|
|000032e0| 29 3b 0d 09 09 09 0d 09 | 09 09 2f 2a 20 61 6e 64 |);......|../* and|
|000032f0| 20 72 65 6c 65 61 73 65 | 20 6f 75 72 20 72 65 66 | release| our ref|
|00003300| 65 72 65 6e 63 65 20 74 | 6f 20 74 68 65 20 70 61 |erence t|o the pa|
|00003310| 74 68 20 6e 6f 77 20 74 | 68 61 74 20 77 65 27 72 |th now t|hat we'r|
|00003320| 65 20 64 6f 6e 65 20 77 | 69 74 68 20 69 74 20 2a |e done w|ith it *|
|00003330| 2f 0d 09 09 09 69 66 20 | 28 21 73 74 61 74 75 73 |/....if |(!status|
|00003340| 29 20 7b 0d 09 09 09 09 | 73 74 61 74 75 73 20 3d |) {.....|status =|
|00003350| 20 53 52 52 65 6c 65 61 | 73 65 4f 62 6a 65 63 74 | SRRelea|seObject|
|00003360| 20 28 73 74 6f 63 6b 50 | 61 74 68 29 3b 0d 09 09 | (stockP|ath);...|
|00003370| 09 09 73 74 6f 63 6b 50 | 61 74 68 20 3d 20 4e 55 |..stockP|ath = NU|
|00003380| 4c 4c 3b 0d 09 09 09 7d | 0d 09 09 7d 0d 09 09 0d |LL;....}|...}....|
|00003390| 09 09 2f 2a 20 69 66 20 | 77 65 20 68 61 64 20 61 |../* if |we had a|
|000033a0| 6e 79 20 70 72 6f 62 6c | 65 6d 73 20 61 6c 6f 6e |ny probl|ems alon|
|000033b0| 67 20 74 68 65 20 77 61 | 79 2c 20 63 6c 65 61 6e |g the wa|y, clean|
|000033c0| 20 75 70 20 68 65 72 65 | 20 2a 2f 0d 09 09 69 66 | up here| */...if|
|000033d0| 20 28 73 74 61 74 75 73 | 29 20 7b 0d 09 09 09 69 | (status|) {....i|
|000033e0| 66 20 28 77 68 61 74 50 | 68 72 61 73 65 29 20 53 |f (whatP|hrase) S|
|000033f0| 52 52 65 6c 65 61 73 65 | 4f 62 6a 65 63 74 20 28 |RRelease|Object (|
|00003400| 77 68 61 74 50 68 72 61 | 73 65 29 3b 09 2f 2a 20 |whatPhra|se);./* |
|00003410| 73 74 61 74 75 73 20 69 | 67 6e 6f 72 65 64 20 2a |status i|gnored *|
|00003420| 2f 0d 09 09 09 69 66 20 | 28 63 6f 6d 70 61 6e 79 |/....if |(company|
|00003430| 4c 4d 29 20 53 52 52 65 | 6c 65 61 73 65 4f 62 6a |LM) SRRe|leaseObj|
|00003440| 65 63 74 20 28 63 6f 6d | 70 61 6e 79 4c 4d 29 3b |ect (com|panyLM);|
|00003450| 0d 09 09 09 69 66 20 28 | 73 74 6f 63 6b 57 6f 72 |....if (|stockWor|
|00003460| 64 29 20 53 52 52 65 6c | 65 61 73 65 4f 62 6a 65 |d) SRRel|easeObje|
|00003470| 63 74 20 28 73 74 6f 63 | 6b 57 6f 72 64 29 3b 0d |ct (stoc|kWord);.|
|00003480| 09 09 09 69 66 20 28 73 | 74 6f 63 6b 50 61 74 68 |...if (s|tockPath|
|00003490| 29 20 53 52 52 65 6c 65 | 61 73 65 4f 62 6a 65 63 |) SRRele|aseObjec|
|000034a0| 74 20 28 73 74 6f 63 6b | 50 61 74 68 29 3b 0d 09 |t (stock|Path);..|
|000034b0| 09 7d 0d 09 7d 0d 09 0d | 09 72 65 74 75 72 6e 20 |.}..}...|.return |
|000034c0| 73 74 61 74 75 73 3b 0d | 7d 0d 0d 0d 2f 2a 09 48 |status;.|}.../*.H|
|000034d0| 61 6e 64 6c 65 52 65 63 | 6f 67 6e 69 74 69 6f 6e |andleRec|ognition|
|000034e0| 44 6f 6e 65 41 45 0d 0d | 09 54 68 69 73 20 69 73 |DoneAE..|.This is|
|000034f0| 20 6f 75 72 20 41 70 70 | 6c 65 45 76 65 6e 74 20 | our App|leEvent |
|00003500| 68 61 6e 64 6c 65 72 20 | 66 6f 72 20 74 68 65 20 |handler |for the |
|00003510| 6b 53 52 52 65 63 6f 67 | 6e 69 74 69 6f 6e 44 6f |kSRRecog|nitionDo|
|00003520| 6e 65 20 41 70 70 6c 65 | 45 76 65 6e 74 2e 0d 09 |ne Apple|Event...|
|00003530| 49 74 20 65 78 74 72 61 | 63 74 73 20 74 68 65 20 |It extra|cts the |
|00003540| 72 65 63 6f 67 6e 69 74 | 69 6f 6e 20 73 74 61 74 |recognit|ion stat|
|00003550| 75 73 20 63 6f 64 65 2c | 20 61 6e 64 20 69 66 20 |us code,| and if |
|00003560| 74 68 65 72 65 27 73 20 | 73 6f 6d 65 74 68 69 6e |there's |somethin|
|00003570| 67 20 74 6f 0d 09 70 72 | 6f 63 65 73 73 2c 20 69 |g to..pr|ocess, i|
|00003580| 74 20 65 78 74 72 61 63 | 74 73 20 74 68 65 20 72 |t extrac|ts the r|
|00003590| 65 63 6f 67 6e 69 7a 65 | 72 20 61 6e 64 20 72 65 |ecognize|r and re|
|000035a0| 63 6f 67 6e 69 74 69 6f | 6e 20 72 65 73 75 6c 74 |cognitio|n result|
|000035b0| 20 6f 62 6a 65 63 74 73 | 20 66 72 6f 6d 0d 09 74 | objects| from..t|
|000035c0| 68 65 20 41 70 70 6c 65 | 45 76 65 6e 74 2e 20 20 |he Apple|Event. |
|000035d0| 54 68 65 73 65 20 61 72 | 65 20 74 68 65 6e 20 70 |These ar|e then p|
|000035e0| 72 6f 63 65 73 73 20 69 | 6e 20 50 72 6f 63 65 73 |rocess i|n Proces|
|000035f0| 73 52 65 63 6f 67 6e 69 | 74 69 6f 6e 52 65 73 75 |sRecogni|tionResu|
|00003600| 6c 74 0d 2a 2f 0d 0d 70 | 61 73 63 61 6c 20 4f 53 |lt.*/..p|ascal OS|
|00003610| 45 72 72 20 48 61 6e 64 | 6c 65 52 65 63 6f 67 6e |Err Hand|leRecogn|
|00003620| 69 74 69 6f 6e 44 6f 6e | 65 41 45 20 28 41 70 70 |itionDon|eAE (App|
|00003630| 6c 65 45 76 65 6e 74 20 | 2a 74 68 65 41 45 65 76 |leEvent |*theAEev|
|00003640| 74 2c 20 41 70 70 6c 65 | 45 76 65 6e 74 20 2a 72 |t, Apple|Event *r|
|00003650| 65 70 6c 79 2c 20 6c 6f | 6e 67 20 72 65 66 63 6f |eply, lo|ng refco|
|00003660| 6e 29 0d 7b 0d 09 4f 53 | 45 72 72 20 72 65 63 6f |n).{..OS|Err reco|
|00003670| 67 6e 69 74 69 6f 6e 53 | 74 61 74 75 73 20 3d 20 |gnitionS|tatus = |
|00003680| 30 2c 20 73 74 61 74 75 | 73 3b 0d 09 6c 6f 6e 67 |0, statu|s;..long|
|00003690| 20 61 63 74 75 61 6c 53 | 69 7a 65 3b 0d 09 44 65 | actualS|ize;..De|
|000036a0| 73 63 54 79 70 65 20 61 | 63 74 75 61 6c 54 79 70 |scType a|ctualTyp|
|000036b0| 65 3b 0d 09 0d 09 2f 2a | 20 47 65 74 20 72 65 63 |e;..../*| Get rec|
|000036c0| 6f 67 6e 69 74 69 6f 6e | 20 72 65 73 75 6c 74 20 |ognition| result |
|000036d0| 73 74 61 74 75 73 2e 20 | 2a 2f 0d 09 73 74 61 74 |status. |*/..stat|
|000036e0| 75 73 20 3d 20 41 45 47 | 65 74 50 61 72 61 6d 50 |us = AEG|etParamP|
|000036f0| 74 72 20 28 74 68 65 41 | 45 65 76 74 2c 20 6b 65 |tr (theA|Eevt, ke|
|00003700| 79 53 52 53 70 65 65 63 | 68 53 74 61 74 75 73 2c |ySRSpeec|hStatus,|
|00003710| 20 74 79 70 65 53 68 6f | 72 74 49 6e 74 65 67 65 | typeSho|rtIntege|
|00003720| 72 2c 20 26 61 63 74 75 | 61 6c 54 79 70 65 2c 20 |r, &actu|alType, |
|00003730| 28 50 74 72 29 20 26 72 | 65 63 6f 67 6e 69 74 69 |(Ptr) &r|ecogniti|
|00003740| 6f 6e 53 74 61 74 75 73 | 2c 20 73 69 7a 65 6f 66 |onStatus|, sizeof|
|00003750| 20 28 72 65 63 6f 67 6e | 69 74 69 6f 6e 53 74 61 | (recogn|itionSta|
|00003760| 74 75 73 29 2c 20 26 61 | 63 74 75 61 6c 53 69 7a |tus), &a|ctualSiz|
|00003770| 65 29 3b 0d 09 0d 09 2f | 2a 20 47 65 74 20 74 68 |e);..../|* Get th|
|00003780| 65 20 53 52 52 65 63 6f | 67 6e 69 7a 65 72 20 2a |e SRReco|gnizer *|
|00003790| 2f 0d 09 69 66 20 28 21 | 73 74 61 74 75 73 20 26 |/..if (!|status &|
|000037a0| 26 20 21 72 65 63 6f 67 | 6e 69 74 69 6f 6e 53 74 |& !recog|nitionSt|
|000037b0| 61 74 75 73 29 20 7b 0d | 09 09 53 52 52 65 63 6f |atus) {.|..SRReco|
|000037c0| 67 6e 69 7a 65 72 20 72 | 65 63 6f 67 6e 69 7a 65 |gnizer r|ecognize|
|000037d0| 72 3b 0d 09 09 73 74 61 | 74 75 73 20 3d 20 41 45 |r;...sta|tus = AE|
|000037e0| 47 65 74 50 61 72 61 6d | 50 74 72 20 28 74 68 65 |GetParam|Ptr (the|
|000037f0| 41 45 65 76 74 2c 20 6b | 65 79 53 52 52 65 63 6f |AEevt, k|eySRReco|
|00003800| 67 6e 69 7a 65 72 2c 20 | 74 79 70 65 53 52 52 65 |gnizer, |typeSRRe|
|00003810| 63 6f 67 6e 69 7a 65 72 | 2c 20 26 61 63 74 75 61 |cognizer|, &actua|
|00003820| 6c 54 79 70 65 2c 20 28 | 50 74 72 29 20 26 72 65 |lType, (|Ptr) &re|
|00003830| 63 6f 67 6e 69 7a 65 72 | 2c 20 73 69 7a 65 6f 66 |cognizer|, sizeof|
|00003840| 20 28 72 65 63 6f 67 6e | 69 7a 65 72 29 2c 20 26 | (recogn|izer), &|
|00003850| 61 63 74 75 61 6c 53 69 | 7a 65 29 3b 0d 09 09 0d |actualSi|ze);....|
|00003860| 09 09 2f 2a 20 47 65 74 | 20 74 68 65 20 53 52 52 |../* Get| the SRR|
|00003870| 65 63 6f 67 6e 69 74 69 | 6f 6e 52 65 73 75 6c 74 |ecogniti|onResult|
|00003880| 20 2a 2f 0d 09 09 69 66 | 20 28 21 73 74 61 74 75 | */...if| (!statu|
|00003890| 73 29 20 7b 0d 09 09 09 | 53 52 52 65 63 6f 67 6e |s) {....|SRRecogn|
|000038a0| 69 74 69 6f 6e 52 65 73 | 75 6c 74 20 72 65 63 52 |itionRes|ult recR|
|000038b0| 65 73 75 6c 74 3b 0d 09 | 09 09 73 74 61 74 75 73 |esult;..|..status|
|000038c0| 20 3d 20 41 45 47 65 74 | 50 61 72 61 6d 50 74 72 | = AEGet|ParamPtr|
|000038d0| 20 28 74 68 65 41 45 65 | 76 74 2c 20 6b 65 79 53 | (theAEe|vt, keyS|
|000038e0| 52 53 70 65 65 63 68 52 | 65 73 75 6c 74 2c 20 74 |RSpeechR|esult, t|
|000038f0| 79 70 65 53 52 53 70 65 | 65 63 68 52 65 73 75 6c |ypeSRSpe|echResul|
|00003900| 74 2c 20 26 61 63 74 75 | 61 6c 54 79 70 65 2c 20 |t, &actu|alType, |
|00003910| 28 50 74 72 29 20 26 72 | 65 63 52 65 73 75 6c 74 |(Ptr) &r|ecResult|
|00003920| 2c 20 73 69 7a 65 6f 66 | 20 28 72 65 63 52 65 73 |, sizeof| (recRes|
|00003930| 75 6c 74 29 2c 20 26 61 | 63 74 75 61 6c 53 69 7a |ult), &a|ctualSiz|
|00003940| 65 29 3b 0d 09 09 09 0d | 09 09 09 2f 2a 20 65 78 |e);.....|.../* ex|
|00003950| 74 72 61 63 74 20 74 68 | 65 20 6c 61 6e 67 75 61 |tract th|e langua|
|00003960| 67 65 20 6d 6f 64 65 6c | 20 66 72 6f 6d 20 74 68 |ge model| from th|
|00003970| 65 20 72 65 73 75 6c 74 | 20 2a 2f 0d 09 09 09 69 |e result| */....i|
|00003980| 66 20 28 21 73 74 61 74 | 75 73 29 20 7b 0d 09 09 |f (!stat|us) {...|
|00003990| 09 09 53 52 4c 61 6e 67 | 75 61 67 65 4d 6f 64 65 |..SRLang|uageMode|
|000039a0| 6c 20 72 65 73 75 6c 74 | 4c 4d 3b 0d 09 09 09 09 |l result|LM;.....|
|000039b0| 6c 6f 6e 67 20 70 72 6f | 70 65 72 74 79 53 69 7a |long pro|pertySiz|
|000039c0| 65 20 3d 20 73 69 7a 65 | 6f 66 20 28 72 65 73 75 |e = size|of (resu|
|000039d0| 6c 74 4c 4d 29 3b 0d 09 | 09 09 09 0d 09 09 09 09 |ltLM);..|........|
|000039e0| 2f 2a 20 66 69 72 73 74 | 20 67 65 74 20 74 68 65 |/* first| get the|
|000039f0| 20 74 65 78 74 20 66 72 | 6f 6d 20 74 68 65 20 72 | text fr|om the r|
|00003a00| 65 73 75 6c 74 20 61 6e | 64 20 64 69 73 70 6c 61 |esult an|d displa|
|00003a10| 79 20 69 74 20 69 6e 20 | 6f 75 72 20 64 69 61 6c |y it in |our dial|
|00003a20| 6f 67 20 2a 2f 0d 09 09 | 09 09 73 74 61 74 75 73 |og */...|..status|
|00003a30| 20 3d 20 44 69 73 70 6c | 61 79 52 65 63 6f 67 6e | = Displ|ayRecogn|
|00003a40| 69 7a 65 64 54 65 78 74 | 20 28 72 65 63 52 65 73 |izedText| (recRes|
|00003a50| 75 6c 74 29 3b 0d 09 09 | 09 09 0d 09 09 09 09 2f |ult);...|......./|
|00003a60| 2a 20 67 65 74 20 74 68 | 65 20 6c 61 6e 67 75 61 |* get th|e langua|
|00003a70| 67 65 20 6d 6f 64 65 6c | 20 6f 75 74 20 6f 66 20 |ge model| out of |
|00003a80| 74 68 65 20 72 65 63 6f | 67 6e 69 74 69 6f 6e 20 |the reco|gnition |
|00003a90| 72 65 73 75 6c 74 20 2a | 2f 09 09 09 09 0d 09 09 |result *|/.......|
|00003aa0| 09 09 69 66 20 28 21 73 | 74 61 74 75 73 29 0d 09 |..if (!s|tatus)..|
|00003ab0| 09 09 09 09 73 74 61 74 | 75 73 20 3d 20 53 52 47 |....stat|us = SRG|
|00003ac0| 65 74 50 72 6f 70 65 72 | 74 79 20 28 72 65 63 52 |etProper|ty (recR|
|00003ad0| 65 73 75 6c 74 2c 20 6b | 53 52 4c 61 6e 67 75 61 |esult, k|SRLangua|
|00003ae0| 67 65 4d 6f 64 65 6c 46 | 6f 72 6d 61 74 2c 20 26 |geModelF|ormat, &|
|00003af0| 72 65 73 75 6c 74 4c 4d | 2c 20 26 70 72 6f 70 65 |resultLM|, &prope|
|00003b00| 72 74 79 53 69 7a 65 29 | 3b 0d 0d 09 09 09 09 2f |rtySize)|;....../|
|00003b10| 2a 20 70 72 6f 63 65 73 | 73 20 74 68 65 20 6c 61 |* proces|s the la|
|00003b20| 6e 67 75 61 67 65 20 6d | 6f 64 65 6c 20 2a 2f 0d |nguage m|odel */.|
|00003b30| 09 09 09 09 69 66 20 28 | 21 73 74 61 74 75 73 29 |....if (|!status)|
|00003b40| 20 7b 0d 09 09 09 09 09 | 73 74 61 74 75 73 20 3d | {......|status =|
|00003b50| 20 50 72 6f 63 65 73 73 | 52 65 63 6f 67 6e 69 74 | Process|Recognit|
|00003b60| 69 6f 6e 52 65 73 75 6c | 74 20 28 72 65 73 75 6c |ionResul|t (resul|
|00003b70| 74 4c 4d 2c 20 72 65 63 | 6f 67 6e 69 7a 65 72 29 |tLM, rec|ognizer)|
|00003b80| 3b 0d 09 09 09 09 0d 09 | 09 09 09 09 2f 2a 20 77 |;.......|..../* w|
|00003b90| 68 61 74 20 77 65 20 53 | 52 47 6f 74 c9 20 77 65 |hat we S|RGot. we|
|00003ba0| 20 6d 75 73 74 20 53 52 | 52 65 6c 65 61 73 65 c9 | must SR|Release.|
|00003bb0| 21 20 2a 2f 0d 09 09 09 | 09 09 53 52 52 65 6c 65 |! */....|..SRRele|
|00003bc0| 61 73 65 4f 62 6a 65 63 | 74 20 28 72 65 73 75 6c |aseObjec|t (resul|
|00003bd0| 74 4c 4d 29 3b 0d 09 09 | 09 09 7d 0d 09 09 09 09 |tLM);...|..}.....|
|00003be0| 2f 2a 20 41 6c 73 6f 20 | 72 65 6c 65 61 73 65 20 |/* Also |release |
|00003bf0| 74 68 65 20 72 65 63 6f | 67 6e 69 74 69 6f 6e 20 |the reco|gnition |
|00003c00| 72 65 73 75 6c 74 20 2a | 2f 0d 09 09 09 09 53 52 |result *|/.....SR|
|00003c10| 52 65 6c 65 61 73 65 4f | 62 6a 65 63 74 20 28 72 |ReleaseO|bject (r|
|00003c20| 65 63 52 65 73 75 6c 74 | 29 3b 0d 09 09 09 7d 0d |ecResult|);....}.|
|00003c30| 09 09 7d 0d 09 7d 0d 09 | 0d 09 2f 2a 20 69 66 20 |..}..}..|../* if |
|00003c40| 72 65 63 6f 67 6e 69 74 | 69 6f 6e 20 77 65 6e 74 |recognit|ion went|
|00003c50| 20 66 69 6e 65 2c 20 68 | 6f 77 20 61 62 6f 75 74 | fine, h|ow about|
|00003c60| 20 74 68 65 20 70 72 6f | 63 65 73 73 69 6e 67 3f | the pro|cessing?|
|00003c70| 20 2a 2f 0d 09 72 65 74 | 75 72 6e 20 72 65 63 6f | */..ret|urn reco|
|00003c80| 67 6e 69 74 69 6f 6e 53 | 74 61 74 75 73 20 3f 20 |gnitionS|tatus ? |
|00003c90| 72 65 63 6f 67 6e 69 74 | 69 6f 6e 53 74 61 74 75 |recognit|ionStatu|
|00003ca0| 73 20 3a 20 73 74 61 74 | 75 73 3b 0d 7d 0d 0d 2f |s : stat|us;.}../|
|00003cb0| 2a 09 50 72 6f 63 65 73 | 73 52 65 63 6f 67 6e 69 |*.Proces|sRecogni|
|00003cc0| 74 69 6f 6e 52 65 73 75 | 6c 74 0d 0d 09 50 72 6f |tionResu|lt...Pro|
|00003cd0| 63 65 73 73 20 74 68 65 | 20 72 65 63 6f 67 69 74 |cess the| recogit|
|00003ce0| 69 6f 6e 20 72 65 73 75 | 6c 74 20 68 65 72 65 2e |ion resu|lt here.|
|00003cf0| 20 20 47 65 74 20 74 68 | 65 20 6b 53 52 4c 4d 46 | Get th|e kSRLMF|
|00003d00| 6f 72 6d 61 74 20 28 53 | 52 4c 61 6e 67 75 67 61 |ormat (S|RLanguga|
|00003d10| 65 4d 6f 64 65 6c 29 20 | 70 72 6f 70 65 72 74 79 |eModel) |property|
|00003d20| 20 66 72 6f 6d 0d 09 74 | 68 65 20 72 65 63 6f 67 | from..t|he recog|
|00003d30| 6e 74 69 6f 6e 20 72 65 | 73 75 6c 74 3b 20 69 74 |ntion re|sult; it|
|00003d40| 20 69 73 20 61 20 53 52 | 4c 61 6e 67 75 61 67 65 | is a SR|Language|
|00003d50| 4d 6f 64 65 6c 20 6f 62 | 6a 65 63 74 20 77 68 6f |Model ob|ject who|
|00003d60| 73 65 20 63 6f 6e 74 65 | 6e 74 73 20 63 6f 72 72 |se conte|nts corr|
|00003d70| 65 73 70 6f 6e 64 20 74 | 6f 20 74 68 65 20 77 6f |espond t|o the wo|
|00003d80| 72 64 73 0d 09 74 68 61 | 74 20 77 65 72 65 20 68 |rds..tha|t were h|
|00003d90| 65 61 72 64 2e 20 20 42 | 79 20 69 6e 73 70 65 63 |eard. B|y inspec|
|00003da0| 74 69 6e 67 20 74 68 65 | 20 72 65 66 63 6f 6e 20 |ting the| refcon |
|00003db0| 6f 66 20 74 68 65 20 66 | 69 72 73 74 20 69 74 65 |of the f|irst ite|
|00003dc0| 6d 20 69 6e 20 74 68 69 | 73 20 6c 61 6e 67 75 61 |m in thi|s langua|
|00003dd0| 67 65 20 6d 6f 64 65 6c | 2c 20 77 65 0d 09 74 68 |ge model|, we..th|
|00003de0| 65 20 66 69 72 73 74 20 | 69 74 65 6d 20 63 6f 6e |e first |item con|
|00003df0| 74 61 69 6e 65 64 20 69 | 6e 20 74 68 69 73 20 0d |tained i|n this .|
|00003e00| 2a 2f 0d 0d 4f 53 45 72 | 72 20 50 72 6f 63 65 73 |*/..OSEr|r Proces|
|00003e10| 73 52 65 63 6f 67 6e 69 | 74 69 6f 6e 52 65 73 75 |sRecogni|tionResu|
|00003e20| 6c 74 20 28 53 52 4c 61 | 6e 67 75 61 67 65 4d 6f |lt (SRLa|nguageMo|
|00003e30| 64 65 6c 20 72 65 73 75 | 6c 74 4c 4d 2c 20 53 52 |del resu|ltLM, SR|
|00003e40| 52 65 63 6f 67 6e 69 7a | 65 72 20 72 65 63 6f 67 |Recogniz|er recog|
|00003e50| 6e 69 7a 65 72 29 0d 7b | 0d 09 4f 53 45 72 72 09 |nizer).{|..OSErr.|
|00003e60| 73 74 61 74 75 73 20 3d | 20 6e 6f 45 72 72 3b 0d |status =| noErr;.|
|00003e70| 09 0d 09 69 66 20 28 72 | 65 73 75 6c 74 4c 4d 20 |...if (r|esultLM |
|00003e80| 26 26 20 72 65 63 6f 67 | 6e 69 7a 65 72 29 20 7b |&& recog|nizer) {|
|00003e90| 0d 09 09 6c 6f 6e 67 20 | 72 65 66 63 6f 6e 3b 0d |...long |refcon;.|
|00003ea0| 09 09 6c 6f 6e 67 20 70 | 72 6f 70 65 72 74 79 53 |..long p|ropertyS|
|00003eb0| 69 7a 65 20 3d 20 73 69 | 7a 65 6f 66 20 28 72 65 |ize = si|zeof (re|
|00003ec0| 66 63 6f 6e 29 3b 0d 09 | 09 0d 09 09 73 74 61 74 |fcon);..|....stat|
|00003ed0| 75 73 20 3d 20 53 52 47 | 65 74 50 72 6f 70 65 72 |us = SRG|etProper|
|00003ee0| 74 79 20 28 72 65 73 75 | 6c 74 4c 4d 2c 20 6b 53 |ty (resu|ltLM, kS|
|00003ef0| 52 52 65 66 43 6f 6e 2c | 20 26 72 65 66 63 6f 6e |RRefCon,| &refcon|
|00003f00| 2c 20 26 70 72 6f 70 65 | 72 74 79 53 69 7a 65 29 |, &prope|rtySize)|
|00003f10| 3b 0d 09 09 0d 09 09 2f | 2a 20 69 73 20 74 68 65 |;....../|* is the|
|00003f20| 20 72 65 73 75 6c 74 4c | 4d 20 61 20 73 75 62 73 | resultL|M a subs|
|00003f30| 65 74 20 6f 66 20 6f 75 | 72 20 74 6f 70 20 6c 61 |et of ou|r top la|
|00003f40| 6e 67 75 61 67 65 20 6d | 6f 64 65 6c 20 6f 72 20 |nguage m|odel or |
|00003f50| 69 73 20 69 74 20 74 68 | 65 20 72 65 6a 65 63 74 |is it th|e reject|
|00003f60| 69 6f 6e 20 77 6f 72 64 | 2c 20 22 3f 3f 3f 22 20 |ion word|, "???" |
|00003f70| 3f 20 2a 2f 0d 09 09 69 | 66 20 28 21 73 74 61 74 |? */...i|f (!stat|
|00003f80| 75 73 20 26 26 20 72 65 | 66 63 6f 6e 20 3d 3d 20 |us && re|fcon == |
|00003f90| 6b 54 6f 70 4c 4d 52 65 | 66 63 6f 6e 29 20 7b 0d |kTopLMRe|fcon) {.|
|00003fa0| 09 09 09 53 52 4c 61 6e | 67 75 61 67 65 4f 62 6a |...SRLan|guageObj|
|00003fb0| 65 63 74 20 6c 61 6e 67 | 75 61 67 65 4f 62 6a 65 |ect lang|uageObje|
|00003fc0| 63 74 3b 0d 09 09 09 70 | 72 6f 70 65 72 74 79 53 |ct;....p|ropertyS|
|00003fd0| 69 7a 65 20 3d 20 73 69 | 7a 65 6f 66 20 28 6c 61 |ize = si|zeof (la|
|00003fe0| 6e 67 75 61 67 65 4f 62 | 6a 65 63 74 29 3b 0d 0d |nguageOb|ject);..|
|00003ff0| 09 09 09 2f 2a 20 54 68 | 65 20 72 65 73 75 6c 74 |.../* Th|e result|
|00004000| 4c 4d 20 63 6f 6e 74 61 | 69 6e 73 20 65 69 74 68 |LM conta|ins eith|
|00004010| 65 72 20 61 6e 20 53 52 | 50 61 74 68 20 6f 72 20 |er an SR|Path or |
|00004020| 61 6e 20 53 52 50 68 72 | 61 73 65 2e 20 20 54 68 |an SRPhr|ase. Th|
|00004030| 65 20 53 52 50 68 72 61 | 73 65 73 20 69 6e 20 67 |e SRPhra|ses in g|
|00004040| 54 6f 70 4c 61 6e 67 75 | 61 67 65 4d 6f 64 65 6c |TopLangu|ageModel|
|00004050| 20 2a 2f 0d 09 09 09 2f | 2a 20 77 65 72 65 20 63 | */..../|* were c|
|00004060| 72 65 61 74 65 64 20 62 | 79 20 74 68 65 20 53 52 |reated b|y the SR|
|00004070| 41 64 64 54 65 78 74 20 | 63 61 6c 6c 73 20 69 6e |AddText |calls in|
|00004080| 20 42 75 69 6c 64 4c 61 | 6e 67 75 61 67 65 4d 6f | BuildLa|nguageMo|
|00004090| 64 65 6c 2e 20 20 54 68 | 65 20 53 52 50 61 74 68 |del. Th|e SRPath|
|000040a0| 20 69 6e 20 2a 2f 0d 09 | 09 09 2f 2a 20 67 54 6f | in */..|../* gTo|
|000040b0| 70 4c 61 6e 67 75 61 67 | 65 4d 6f 64 65 6c 20 77 |pLanguag|eModel w|
|000040c0| 61 73 20 63 72 65 61 74 | 65 64 20 69 6e 20 41 64 |as creat|ed in Ad|
|000040d0| 64 46 61 6e 63 69 65 72 | 4c 61 6e 67 75 61 67 65 |dFancier|Language|
|000040e0| 4d 6f 64 65 6c 2e 20 20 | 57 65 20 75 73 65 20 74 |Model. |We use t|
|000040f0| 68 65 20 72 65 66 63 6f | 6e 20 70 72 6f 70 65 72 |he refco|n proper|
|00004100| 74 79 20 2a 2f 0d 09 09 | 09 2f 2a 20 77 65 20 73 |ty */...|./* we s|
|00004110| 65 74 20 69 6e 20 6f 75 | 72 20 6c 61 6e 67 75 61 |et in ou|r langua|
|00004120| 67 65 20 6d 6f 64 65 6c | 20 62 75 69 6c 64 69 6e |ge model| buildin|
|00004130| 67 20 72 6f 75 74 69 6e | 65 73 20 74 6f 20 64 69 |g routin|es to di|
|00004140| 73 74 69 6e 67 75 69 73 | 68 20 62 65 74 77 65 65 |stinguis|h betwee|
|00004150| 6e 20 74 68 65 20 72 65 | 73 75 6c 74 73 20 2a 2f |n the re|sults */|
|00004160| 0d 09 09 09 0d 09 09 09 | 2f 2a 20 57 65 20 65 78 |........|/* We ex|
|00004170| 70 65 63 74 20 6f 75 72 | 20 72 65 73 75 6c 74 20 |pect our| result |
|00004180| 6c 61 6e 67 75 61 67 65 | 20 6d 6f 64 65 6c 20 74 |language| model t|
|00004190| 6f 20 63 6f 6e 74 61 69 | 6e 20 6f 6e 6c 79 20 31 |o contai|n only 1|
|000041a0| 20 69 74 65 6d 2c 20 61 | 20 70 68 72 61 73 65 20 | item, a| phrase |
|000041b0| 6f 72 20 61 20 70 61 74 | 68 3b 20 67 65 74 20 69 |or a pat|h; get i|
|000041c0| 74 20 2a 2f 0d 09 09 09 | 73 74 61 74 75 73 20 3d |t */....|status =|
|000041d0| 20 53 52 47 65 74 49 6e | 64 65 78 65 64 49 74 65 | SRGetIn|dexedIte|
|000041e0| 6d 20 28 72 65 73 75 6c | 74 4c 4d 2c 20 26 6c 61 |m (resul|tLM, &la|
|000041f0| 6e 67 75 61 67 65 4f 62 | 6a 65 63 74 2c 20 30 29 |nguageOb|ject, 0)|
|00004200| 3b 0d 09 09 09 0d 09 09 | 09 69 66 20 28 21 73 74 |;.......|.if (!st|
|00004210| 61 74 75 73 29 20 7b 0d | 09 09 09 09 6c 6f 6e 67 |atus) {.|....long|
|00004220| 20 72 65 66 63 6f 6e 3b | 0d 09 09 09 09 70 72 6f | refcon;|.....pro|
|00004230| 70 65 72 74 79 53 69 7a | 65 20 3d 20 73 69 7a 65 |pertySiz|e = size|
|00004240| 6f 66 20 28 72 65 66 63 | 6f 6e 29 3b 0d 09 09 09 |of (refc|on);....|
|00004250| 09 0d 09 09 09 09 2f 2a | 20 67 65 74 20 74 68 65 |....../*| get the|
|00004260| 20 72 65 66 63 6f 6e 20 | 6f 66 20 74 68 65 20 6f | refcon |of the o|
|00004270| 62 6a 65 63 74 20 61 74 | 20 74 68 65 20 72 6f 6f |bject at| the roo|
|00004280| 74 20 6f 66 20 6f 75 72 | 20 6c 61 6e 67 75 61 67 |t of our| languag|
|00004290| 65 20 6d 6f 64 65 6c 20 | 2a 2f 0d 09 09 09 09 73 |e model |*/.....s|
|000042a0| 74 61 74 75 73 20 3d 20 | 53 52 47 65 74 50 72 6f |tatus = |SRGetPro|
|000042b0| 70 65 72 74 79 20 28 6c | 61 6e 67 75 61 67 65 4f |perty (l|anguageO|
|000042c0| 62 6a 65 63 74 2c 20 6b | 53 52 52 65 66 43 6f 6e |bject, k|SRRefCon|
|000042d0| 2c 20 26 72 65 66 63 6f | 6e 2c 20 26 70 72 6f 70 |, &refco|n, &prop|
|000042e0| 65 72 74 79 53 69 7a 65 | 29 3b 0d 09 09 09 09 0d |ertySize|);......|
|000042f0| 09 09 09 09 69 66 20 28 | 21 73 74 61 74 75 73 29 |....if (|!status)|
|00004300| 20 73 77 69 74 63 68 20 | 28 72 65 66 63 6f 6e 29 | switch |(refcon)|
|00004310| 20 7b 0d 09 09 09 09 09 | 63 61 73 65 20 6b 48 65 | {......|case kHe|
|00004320| 6c 6c 6f 52 65 66 43 6f | 6e 3a 0d 09 09 09 09 09 |lloRefCo|n:......|
|00004330| 63 61 73 65 20 6b 47 6f | 6f 64 62 79 65 52 65 66 |case kGo|odbyeRef|
|00004340| 43 6f 6e 3a 0d 09 09 09 | 09 09 63 61 73 65 20 6b |Con:....|..case k|
|00004350| 57 68 61 74 54 69 6d 65 | 49 73 49 74 52 65 66 43 |WhatTime|IsItRefC|
|00004360| 6f 6e 3a 20 0d 09 09 09 | 09 09 09 7b 0d 09 09 09 |on: ....|...{....|
|00004370| 09 09 09 09 63 6f 6e 73 | 74 20 63 68 61 72 20 2a |....cons|t char *|
|00004380| 6b 52 65 73 70 6f 6e 73 | 65 73 5b 5d 20 3d 20 0d |kRespons|es[] = .|
|00004390| 09 09 09 09 09 09 09 09 | 7b 09 22 48 69 20 54 68 |........|{."Hi Th|
|000043a0| 65 72 65 21 22 2c 20 0d | 09 09 09 09 09 09 09 09 |ere!", .|........|
|000043b0| 09 22 44 6f 6e 27 74 20 | 6c 65 61 76 65 20 6e 6f |."Don't |leave no|
|000043c0| 77 21 22 2c 0d 09 09 09 | 09 09 09 09 09 09 22 49 |w!",....|......"I|
|000043d0| 74 27 73 20 74 69 6d 65 | 20 74 6f 20 75 73 65 20 |t's time| to use |
|000043e0| 74 68 65 20 53 70 65 65 | 63 68 20 52 65 63 6f 67 |the Spee|ch Recog|
|000043f0| 6e 69 74 69 6f 6e 20 4d | 61 6e 61 67 65 72 21 22 |nition M|anager!"|
|00004400| 20 0d 09 09 09 09 09 09 | 09 09 7d 3b 0d 09 09 09 | .......|..};....|
|00004410| 09 09 09 09 2f 2a 20 73 | 70 65 61 6b 20 61 6e 64 |..../* s|peak and|
|00004420| 20 64 69 73 70 6c 61 79 | 20 6f 75 72 20 72 65 73 | display| our res|
|00004430| 70 6f 6e 73 65 20 75 73 | 69 6e 67 20 74 68 65 20 |ponse us|ing the |
|00004440| 66 65 65 64 62 61 63 6b | 20 63 68 61 72 61 63 74 |feedback| charact|
|00004450| 65 72 2e 20 55 73 65 20 | 2a 2f 0d 09 09 09 09 09 |er. Use |*/......|
|00004460| 09 09 2f 2a 20 74 68 65 | 20 72 65 66 63 6f 6e 20 |../* the| refcon |
|00004470| 61 73 20 61 6e 20 69 6e | 64 65 78 20 69 6e 74 6f |as an in|dex into|
|00004480| 20 6f 75 72 20 72 65 73 | 70 6f 6e 73 65 20 61 72 | our res|ponse ar|
|00004490| 72 61 79 20 2a 2f 0d 09 | 09 09 09 09 09 09 73 74 |ray */..|......st|
|000044a0| 61 74 75 73 20 3d 20 53 | 52 53 70 65 61 6b 41 6e |atus = S|RSpeakAn|
|000044b0| 64 44 72 61 77 54 65 78 | 74 20 28 72 65 63 6f 67 |dDrawTex|t (recog|
|000044c0| 6e 69 7a 65 72 2c 20 6b | 52 65 73 70 6f 6e 73 65 |nizer, k|Response|
|000044d0| 73 5b 72 65 66 63 6f 6e | 5d 2c 20 73 74 72 6c 65 |s[refcon|], strle|
|000044e0| 6e 20 28 6b 52 65 73 70 | 6f 6e 73 65 73 5b 72 65 |n (kResp|onses[re|
|000044f0| 66 63 6f 6e 5d 29 29 3b | 0d 09 09 09 09 09 09 7d |fcon]));|.......}|
|00004500| 0d 09 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |.......b|reak;...|
|00004510| 09 09 09 63 61 73 65 20 | 6b 43 6f 6d 70 61 6e 79 |...case |kCompany|
|00004520| 52 65 66 43 6f 6e 3a 0d | 09 09 09 09 09 09 73 74 |RefCon:.|......st|
|00004530| 61 74 75 73 20 3d 20 50 | 72 6f 63 65 73 73 46 61 |atus = P|rocessFa|
|00004540| 6e 63 69 65 72 4c 61 6e | 67 75 61 67 65 4d 6f 64 |ncierLan|guageMod|
|00004550| 65 6c 20 28 6c 61 6e 67 | 75 61 67 65 4f 62 6a 65 |el (lang|uageObje|
|00004560| 63 74 2c 20 72 65 63 6f | 67 6e 69 7a 65 72 29 3b |ct, reco|gnizer);|
|00004570| 0d 09 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |.......b|reak;...|
|00004580| 09 09 7d 0d 09 09 09 09 | 0d 09 09 09 09 2f 2a 20 |..}.....|...../* |
|00004590| 61 6c 77 61 79 73 20 53 | 52 52 65 6c 65 61 73 65 |always S|RRelease|
|000045a0| c9 20 77 68 61 74 20 77 | 65 20 53 52 47 6f 74 c9 |. what w|e SRGot.|
|000045b0| 20 2a 2f 0d 09 09 09 09 | 73 74 61 74 75 73 20 3d | */.....|status =|
|000045c0| 20 53 52 52 65 6c 65 61 | 73 65 4f 62 6a 65 63 74 | SRRelea|seObject|
|000045d0| 20 28 6c 61 6e 67 75 61 | 67 65 4f 62 6a 65 63 74 | (langua|geObject|
|000045e0| 29 3b 0d 09 09 09 7d 0d | 09 09 7d 0d 09 7d 0d 09 |);....}.|..}..}..|
|000045f0| 0d 09 72 65 74 75 72 6e | 20 73 74 61 74 75 73 3b |..return| status;|
|00004600| 0d 7d 0d 0d 2f 2a 09 50 | 72 6f 63 65 73 73 46 61 |.}../*.P|rocessFa|
|00004610| 6e 63 69 65 72 4c 61 6e | 67 75 61 67 65 4d 6f 64 |ncierLan|guageMod|
|00004620| 65 6c 0d 09 0d 09 54 68 | 65 20 53 52 50 61 74 68 |el....Th|e SRPath|
|00004630| 20 63 6f 6e 74 61 69 6e | 73 20 32 20 6f 72 20 33 | contain|s 2 or 3|
|00004640| 20 69 74 65 6d 73 3a 20 | 61 20 70 68 72 61 73 65 | items: |a phrase|
|00004650| 20 22 54 65 6c 6c 20 6d | 65 20 74 68 65 20 70 72 | "Tell m|e the pr|
|00004660| 69 63 65 20 6f 66 22 2c | 20 61 6e 20 65 6d 62 65 |ice of",| an embe|
|00004670| 64 64 65 64 0d 09 6c 61 | 6e 67 75 61 67 65 20 6d |dded..la|nguage m|
|00004680| 6f 64 65 6c 20 3c 63 6f | 6d 70 61 6e 79 3e 20 61 |odel <co|mpany> a|
|00004690| 6e 64 20 70 65 72 68 61 | 70 73 20 74 68 65 20 77 |nd perha|ps the w|
|000046a0| 6f 72 64 20 27 73 74 6f | 63 6b 27 2e 20 20 4f 75 |ord 'sto|ck'. Ou|
|000046b0| 72 20 72 65 73 70 6f 6e | 73 65 20 64 65 70 65 6e |r respon|se depen|
|000046c0| 64 73 20 6f 6e 6c 79 0d | 09 6f 6e 20 74 68 65 20 |ds only.|.on the |
|000046d0| 6e 61 6d 65 20 6f 66 20 | 74 68 65 20 63 6f 6d 70 |name of |the comp|
|000046e0| 61 6e 79 20 75 74 74 65 | 72 65 64 2e 20 20 54 68 |any utte|red. Th|
|000046f0| 65 20 63 6f 6d 70 61 6e | 79 20 6e 61 6d 65 20 77 |e compan|y name w|
|00004700| 69 6c 6c 20 61 6c 77 61 | 79 73 20 62 65 20 74 68 |ill alwa|ys be th|
|00004710| 65 20 73 65 63 6f 6e 64 | 0d 09 69 74 65 6d 20 69 |e second|..item i|
|00004720| 6e 20 74 68 65 20 70 61 | 74 68 2c 20 73 6f 20 77 |n the pa|th, so w|
|00004730| 65 20 61 63 63 65 73 73 | 20 69 74 20 64 69 72 65 |e access| it dire|
|00004740| 63 74 6c 79 20 61 6e 64 | 20 72 65 73 70 6f 6e 64 |ctly and| respond|
|00004750| 20 61 70 70 72 6f 70 72 | 69 61 74 65 6c 79 2e 0d | appropr|iately..|
|00004760| 2a 2f 0d 0d 4f 53 45 72 | 72 20 50 72 6f 63 65 73 |*/..OSEr|r Proces|
|00004770| 73 46 61 6e 63 69 65 72 | 4c 61 6e 67 75 61 67 65 |sFancier|Language|
|00004780| 4d 6f 64 65 6c 20 28 53 | 52 50 61 74 68 20 72 65 |Model (S|RPath re|
|00004790| 73 75 6c 74 50 61 74 68 | 2c 20 53 52 52 65 63 6f |sultPath|, SRReco|
|000047a0| 67 6e 69 7a 65 72 20 72 | 65 63 6f 67 6e 69 7a 65 |gnizer r|ecognize|
|000047b0| 72 29 0d 7b 0d 09 4f 53 | 45 72 72 20 73 74 61 74 |r).{..OS|Err stat|
|000047c0| 75 73 20 3d 20 6e 6f 45 | 72 72 3b 0d 09 0d 09 69 |us = noE|rr;....i|
|000047d0| 66 20 28 72 65 73 75 6c | 74 50 61 74 68 20 26 26 |f (resul|tPath &&|
|000047e0| 20 72 65 63 6f 67 6e 69 | 7a 65 72 29 20 7b 0d 09 | recogni|zer) {..|
|000047f0| 09 53 52 4c 61 6e 67 75 | 61 67 65 4d 6f 64 65 6c |.SRLangu|ageModel|
|00004800| 20 63 6f 6d 70 61 6e 79 | 4c 4d 3b 0d 09 09 0d 09 | company|LM;.....|
|00004810| 09 2f 2a 20 67 65 74 20 | 74 68 65 20 73 65 63 6f |./* get |the seco|
|00004820| 6e 64 20 69 74 65 6d 20 | 69 6e 20 74 68 65 20 70 |nd item |in the p|
|00004830| 61 74 68 20 d1 20 69 74 | 27 73 20 74 68 65 20 63 |ath . it|'s the c|
|00004840| 6f 6d 70 61 6e 79 20 6c | 61 6e 67 75 61 67 65 20 |ompany l|anguage |
|00004850| 6d 6f 64 65 6c 20 20 2a | 2f 0d 09 09 73 74 61 74 |model *|/...stat|
|00004860| 75 73 20 3d 20 53 52 47 | 65 74 49 6e 64 65 78 65 |us = SRG|etIndexe|
|00004870| 64 49 74 65 6d 20 28 72 | 65 73 75 6c 74 50 61 74 |dItem (r|esultPat|
|00004880| 68 2c 20 26 63 6f 6d 70 | 61 6e 79 4c 4d 2c 20 31 |h, &comp|anyLM, 1|
|00004890| 29 3b 0d 09 09 0d 09 09 | 69 66 20 28 21 73 74 61 |);......|if (!sta|
|000048a0| 74 75 73 20 26 26 20 63 | 6f 6d 70 61 6e 79 4c 4d |tus && c|ompanyLM|
|000048b0| 29 20 7b 0d 09 09 09 53 | 52 50 68 72 61 73 65 20 |) {....S|RPhrase |
|000048c0| 63 6f 6d 70 61 6e 79 4e | 61 6d 65 3b 0d 09 09 09 |companyN|ame;....|
|000048d0| 0d 09 09 09 2f 2a 20 74 | 68 65 20 63 6f 6d 70 61 |..../* t|he compa|
|000048e0| 6e 79 20 6c 61 6e 67 75 | 61 67 65 20 6d 6f 64 65 |ny langu|age mode|
|000048f0| 6c 20 77 69 6c 6c 20 63 | 6f 6e 74 61 69 6e 20 6f |l will c|ontain o|
|00004900| 6e 6c 79 20 31 20 70 68 | 72 61 73 65 3b 20 67 65 |nly 1 ph|rase; ge|
|00004910| 74 20 69 74 2e 20 2a 2f | 0d 09 09 09 73 74 61 74 |t it. */|....stat|
|00004920| 75 73 20 3d 20 53 52 47 | 65 74 49 6e 64 65 78 65 |us = SRG|etIndexe|
|00004930| 64 49 74 65 6d 20 28 63 | 6f 6d 70 61 6e 79 4c 4d |dItem (c|ompanyLM|
|00004940| 2c 20 26 63 6f 6d 70 61 | 6e 79 4e 61 6d 65 2c 20 |, &compa|nyName, |
|00004950| 30 29 3b 0d 09 09 09 0d | 09 09 09 69 66 20 28 21 |0);.....|...if (!|
|00004960| 73 74 61 74 75 73 29 20 | 7b 0d 09 09 09 09 6c 6f |status) |{.....lo|
|00004970| 6e 67 09 72 65 66 63 6f | 6e 3b 0d 09 09 09 09 6c |ng.refco|n;.....l|
|00004980| 6f 6e 67 09 70 72 6f 70 | 65 72 74 79 53 69 7a 65 |ong.prop|ertySize|
|00004990| 20 3d 20 73 69 7a 65 6f | 66 20 28 72 65 66 63 6f | = sizeo|f (refco|
|000049a0| 6e 29 3b 0d 09 09 09 09 | 0d 09 09 09 09 2f 2a 20 |n);.....|...../* |
|000049b0| 67 65 74 20 74 68 65 20 | 72 65 66 63 6f 6e 20 66 |get the |refcon f|
|000049c0| 72 6f 6d 20 74 68 65 20 | 63 6f 6d 70 61 6e 79 20 |rom the |company |
|000049d0| 6e 61 6d 65 3b 20 69 74 | 27 73 20 6f 75 72 20 69 |name; it|'s our i|
|000049e0| 6e 64 65 78 20 69 6e 74 | 6f 20 74 68 65 20 72 65 |ndex int|o the re|
|000049f0| 73 70 6f 6e 73 65 20 61 | 72 72 61 79 20 2a 2f 0d |sponse a|rray */.|
|00004a00| 09 09 09 09 73 74 61 74 | 75 73 20 3d 20 53 52 47 |....stat|us = SRG|
|00004a10| 65 74 50 72 6f 70 65 72 | 74 79 20 28 63 6f 6d 70 |etProper|ty (comp|
|00004a20| 61 6e 79 4e 61 6d 65 2c | 20 6b 53 52 52 65 66 43 |anyName,| kSRRefC|
|00004a30| 6f 6e 2c 20 26 72 65 66 | 63 6f 6e 2c 20 26 70 72 |on, &ref|con, &pr|
|00004a40| 6f 70 65 72 74 79 53 69 | 7a 65 29 3b 0d 09 09 09 |opertySi|ze);....|
|00004a50| 09 0d 09 09 09 09 69 66 | 20 28 21 73 74 61 74 75 |......if| (!statu|
|00004a60| 73 29 20 7b 0d 09 09 09 | 09 09 63 6f 6e 73 74 20 |s) {....|..const |
|00004a70| 63 68 61 72 20 2a 6b 52 | 65 73 70 6f 6e 73 65 73 |char *kR|esponses|
|00004a80| 5b 5d 20 3d 20 7b 20 09 | 22 41 70 70 6c 65 20 73 |[] = { .|"Apple s|
|00004a90| 74 6f 63 6b 20 69 73 20 | 70 72 69 63 65 64 20 74 |tock is |priced t|
|00004aa0| 6f 20 6d 6f 76 65 21 22 | 2c 0d 09 09 09 09 09 09 |o move!"|,.......|
|00004ab0| 09 09 09 09 09 09 09 22 | 4e 65 74 73 63 61 70 65 |......."|Netscape|
|00004ac0| 20 69 73 20 74 72 61 64 | 69 6e 67 20 61 74 20 66 | is trad|ing at f|
|00004ad0| 69 66 74 79 20 64 6f 6c | 6c 61 72 73 2e 22 2c 0d |ifty dol|lars.",.|
|00004ae0| 09 09 09 09 09 09 09 09 | 09 09 09 09 09 22 57 68 |........|....."Wh|
|00004af0| 79 20 77 6f 75 6c 64 20 | 79 6f 75 20 77 61 6e 74 |y would |you want|
|00004b00| 20 74 6f 20 6b 6e 6f 77 | 20 74 68 61 74 3f 22 0d | to know| that?".|
|00004b10| 09 09 09 09 09 09 09 09 | 09 09 09 09 7d 3b 0d 09 |........|....};..|
|00004b20| 09 09 09 09 73 74 61 74 | 75 73 20 3d 20 53 52 53 |....stat|us = SRS|
|00004b30| 70 65 61 6b 41 6e 64 44 | 72 61 77 54 65 78 74 20 |peakAndD|rawText |
|00004b40| 28 72 65 63 6f 67 6e 69 | 7a 65 72 2c 20 6b 52 65 |(recogni|zer, kRe|
|00004b50| 73 70 6f 6e 73 65 73 5b | 72 65 66 63 6f 6e 5d 2c |sponses[|refcon],|
|00004b60| 20 73 74 72 6c 65 6e 20 | 28 6b 52 65 73 70 6f 6e | strlen |(kRespon|
|00004b70| 73 65 73 5b 72 65 66 63 | 6f 6e 5d 29 29 3b 0d 09 |ses[refc|on]));..|
|00004b80| 09 09 09 7d 0d 09 09 09 | 09 0d 09 09 09 09 2f 2a |...}....|....../*|
|00004b90| 20 77 68 61 74 20 77 65 | 20 53 52 47 6f 74 c9 20 | what we| SRGot. |
|00004ba0| 77 65 20 6d 75 73 74 20 | 53 52 52 65 6c 65 61 73 |we must |SRReleas|
|00004bb0| 65 c9 20 2a 2f 0d 09 09 | 09 09 73 74 61 74 75 73 |e. */...|..status|
|00004bc0| 20 3d 20 53 52 52 65 6c | 65 61 73 65 4f 62 6a 65 | = SRRel|easeObje|
|00004bd0| 63 74 20 28 63 6f 6d 70 | 61 6e 79 4e 61 6d 65 29 |ct (comp|anyName)|
|00004be0| 3b 0d 09 09 09 7d 0d 09 | 09 09 0d 09 09 09 73 74 |;....}..|......st|
|00004bf0| 61 74 75 73 20 3d 20 53 | 52 52 65 6c 65 61 73 65 |atus = S|RRelease|
|00004c00| 4f 62 6a 65 63 74 20 28 | 63 6f 6d 70 61 6e 79 4c |Object (|companyL|
|00004c10| 4d 29 3b 0d 09 09 7d 0d | 09 7d 0d 0d 09 72 65 74 |M);...}.|.}...ret|
|00004c20| 75 72 6e 20 73 74 61 74 | 75 73 3b 0d 7d 0d 0d 0d |urn stat|us;.}...|
|00004c30| 2f 2a 09 44 69 73 70 6c | 61 79 52 65 63 6f 67 6e |/*.Displ|ayRecogn|
|00004c40| 69 7a 65 64 54 65 78 74 | 0d 0d 09 54 68 69 73 20 |izedText|...This |
|00004c50| 72 6f 75 74 69 6e 65 20 | 65 78 74 72 61 63 74 73 |routine |extracts|
|00004c60| 20 74 68 65 20 74 65 78 | 74 20 66 72 6f 6d 20 74 | the tex|t from t|
|00004c70| 68 65 20 72 65 63 6f 67 | 6e 69 74 69 6f 6e 20 72 |he recog|nition r|
|00004c80| 65 73 75 6c 74 2c 20 77 | 68 61 74 65 76 65 72 20 |esult, w|hatever |
|00004c90| 74 68 61 74 20 74 65 78 | 74 0d 09 6d 69 67 68 74 |that tex|t..might|
|00004ca0| 20 62 65 2c 20 61 6e 64 | 20 64 69 73 70 6c 61 79 | be, and| display|
|00004cb0| 73 20 69 74 20 69 6e 20 | 6f 75 72 20 64 69 61 6c |s it in |our dial|
|00004cc0| 6f 67 2e 0d 2a 2f 0d 0d | 4f 53 45 72 72 20 44 69 |og..*/..|OSErr Di|
|00004cd0| 73 70 6c 61 79 52 65 63 | 6f 67 6e 69 7a 65 64 54 |splayRec|ognizedT|
|00004ce0| 65 78 74 20 28 53 52 52 | 65 63 6f 67 6e 69 74 69 |ext (SRR|ecogniti|
|00004cf0| 6f 6e 52 65 73 75 6c 74 | 20 72 65 73 75 6c 74 29 |onResult| result)|
|00004d00| 0d 7b 0d 09 4f 53 45 72 | 72 20 73 74 61 74 75 73 |.{..OSEr|r status|
|00004d10| 20 3d 20 6e 6f 45 72 72 | 3b 0d 09 0d 09 2f 2a 20 | = noErr|;..../* |
|00004d20| 66 69 72 73 74 20 67 65 | 74 20 74 68 65 20 74 65 |first ge|t the te|
|00004d30| 78 74 20 66 72 6f 6d 20 | 74 68 65 20 72 65 73 75 |xt from |the resu|
|00004d40| 6c 74 20 61 6e 64 20 64 | 69 73 70 6c 61 79 20 69 |lt and d|isplay i|
|00004d50| 74 20 69 6e 20 6f 75 72 | 20 64 69 61 6c 6f 67 20 |t in our| dialog |
|00004d60| 2a 2f 0d 09 69 66 20 28 | 72 65 73 75 6c 74 29 20 |*/..if (|result) |
|00004d70| 7b 0d 09 09 53 74 72 32 | 35 35 09 72 65 73 75 6c |{...Str2|55.resul|
|00004d80| 74 54 65 78 74 3b 0d 09 | 09 6c 6f 6e 67 09 72 65 |tText;..|.long.re|
|00004d90| 73 75 6c 74 54 65 78 74 | 53 69 7a 65 20 3d 20 73 |sultText|Size = s|
|00004da0| 69 7a 65 6f 66 20 28 72 | 65 73 75 6c 74 54 65 78 |izeof (r|esultTex|
|00004db0| 74 29 20 2d 20 31 3b 0d | 09 09 0d 09 09 73 74 61 |t) - 1;.|.....sta|
|00004dc0| 74 75 73 20 3d 20 53 52 | 47 65 74 50 72 6f 70 65 |tus = SR|GetPrope|
|00004dd0| 72 74 79 20 28 72 65 73 | 75 6c 74 2c 20 6b 53 52 |rty (res|ult, kSR|
|00004de0| 54 45 58 54 46 6f 72 6d | 61 74 2c 20 26 72 65 73 |TEXTForm|at, &res|
|00004df0| 75 6c 74 54 65 78 74 5b | 31 5d 2c 20 26 72 65 73 |ultText[|1], &res|
|00004e00| 75 6c 74 54 65 78 74 53 | 69 7a 65 29 3b 0d 09 09 |ultTextS|ize);...|
|00004e10| 0d 09 09 69 66 20 28 21 | 73 74 61 74 75 73 29 20 |...if (!|status) |
|00004e20| 7b 0d 09 09 09 73 68 6f | 72 74 09 69 54 79 70 65 |{....sho|rt.iType|
|00004e30| 3b 0d 09 09 09 48 61 6e | 64 6c 65 09 69 48 61 6e |;....Han|dle.iHan|
|00004e40| 64 6c 65 3b 0d 09 09 09 | 52 65 63 74 09 69 52 65 |dle;....|Rect.iRe|
|00004e50| 63 74 3b 0d 09 09 09 0d | 09 09 09 2f 2a 20 63 72 |ct;.....|.../* cr|
|00004e60| 65 61 74 65 20 70 61 73 | 63 61 6c 20 73 74 72 69 |eate pas|cal stri|
|00004e70| 6e 67 20 6f 66 20 72 65 | 73 75 6c 74 20 74 65 78 |ng of re|sult tex|
|00004e80| 74 20 2a 2f 0d 09 09 09 | 72 65 73 75 6c 74 54 65 |t */....|resultTe|
|00004e90| 78 74 5b 30 5d 20 3d 20 | 28 63 68 61 72 29 20 72 |xt[0] = |(char) r|
|00004ea0| 65 73 75 6c 74 54 65 78 | 74 53 69 7a 65 3b 09 0d |esultTex|tSize;..|
|00004eb0| 09 09 09 0d 09 09 09 47 | 65 74 44 69 61 6c 6f 67 |.......G|etDialog|
|00004ec0| 49 74 65 6d 20 28 67 44 | 69 61 6c 6f 67 2c 20 6b |Item (gD|ialog, k|
|00004ed0| 52 65 73 75 6c 74 54 65 | 78 74 53 74 54 78 2c 20 |ResultTe|xtStTx, |
|00004ee0| 26 69 54 79 70 65 2c 20 | 26 69 48 61 6e 64 6c 65 |&iType, |&iHandle|
|00004ef0| 2c 20 26 69 52 65 63 74 | 29 3b 0d 09 09 09 53 65 |, &iRect|);....Se|
|00004f00| 74 44 69 61 6c 6f 67 49 | 74 65 6d 54 65 78 74 20 |tDialogI|temText |
|00004f10| 28 69 48 61 6e 64 6c 65 | 2c 20 72 65 73 75 6c 74 |(iHandle|, result|
|00004f20| 54 65 78 74 29 3b 09 09 | 09 09 09 2f 2a 20 74 68 |Text);..|.../* th|
|00004f30| 69 73 20 68 61 6e 64 6c | 65 73 20 72 65 64 72 61 |is handl|es redra|
|00004f40| 77 20 2a 2f 0d 09 09 7d | 0d 09 7d 0d 09 0d 09 72 |w */...}|..}....r|
|00004f50| 65 74 75 72 6e 20 73 74 | 61 74 75 73 3b 0d 7d 0d |eturn st|atus;.}.|
|00004f60| 0d 0d 2f 2a 09 45 72 72 | 6f 72 41 6c 65 72 74 0d |../*.Err|orAlert.|
|00004f70| 0d 09 4c 6f 6f 6b 73 20 | 66 6f 72 20 61 6e 20 27 |..Looks |for an '|
|00004f80| 45 73 74 72 27 20 72 65 | 73 6f 75 72 63 65 20 77 |Estr' re|source w|
|00004f90| 69 74 68 20 49 44 20 6d | 61 63 45 72 72 20 61 6e |ith ID m|acErr an|
|00004fa0| 64 20 70 72 6f 76 69 64 | 65 73 20 61 20 64 65 66 |d provid|es a def|
|00004fb0| 61 75 6c 74 20 65 72 72 | 6f 72 0d 09 73 74 72 69 |ault err|or..stri|
|00004fc0| 6e 67 20 69 66 20 6e 6f | 6e 65 20 69 73 20 66 6f |ng if no|ne is fo|
|00004fd0| 75 6e 64 2c 20 74 68 65 | 6e 20 70 6f 73 74 73 20 |und, the|n posts |
|00004fe0| 61 6e 20 61 6c 65 72 74 | 20 66 6f 72 63 69 6e 67 |an alert| forcing|
|00004ff0| 20 74 68 65 20 75 73 65 | 72 20 74 6f 20 71 75 69 | the use|r to qui|
|00005000| 74 2e 0d 2a 2f 0d 0d 76 | 6f 69 64 20 45 72 72 6f |t..*/..v|oid Erro|
|00005010| 72 41 6c 65 72 74 20 28 | 4f 53 45 72 72 20 6d 61 |rAlert (|OSErr ma|
|00005020| 63 45 72 72 29 0d 7b 0d | 09 53 74 72 69 6e 67 48 |cErr).{.|.StringH|
|00005030| 61 6e 64 6c 65 09 65 72 | 72 4d 73 67 3b 0d 09 53 |andle.er|rMsg;..S|
|00005040| 74 72 32 35 35 09 09 09 | 65 72 72 4e 75 6d 3b 0d |tr255...|errNum;.|
|00005050| 09 73 68 6f 72 74 09 09 | 09 69 74 65 6d 48 69 74 |.short..|.itemHit|
|00005060| 3b 0d 0d 09 65 72 72 4d | 73 67 20 3d 20 28 53 74 |;...errM|sg = (St|
|00005070| 72 69 6e 67 48 61 6e 64 | 6c 65 29 20 47 65 74 52 |ringHand|le) GetR|
|00005080| 65 73 6f 75 72 63 65 20 | 28 6b 45 72 72 53 74 72 |esource |(kErrStr|
|00005090| 69 6e 67 54 79 70 65 2c | 20 6d 61 63 45 72 72 29 |ingType,| macErr)|
|000050a0| 3b 0d 09 69 66 20 28 21 | 65 72 72 4d 73 67 29 0d |;..if (!|errMsg).|
|000050b0| 09 09 65 72 72 4d 73 67 | 20 3d 20 28 53 74 72 69 |..errMsg| = (Stri|
|000050c0| 6e 67 48 61 6e 64 6c 65 | 29 20 47 65 74 52 65 73 |ngHandle|) GetRes|
|000050d0| 6f 75 72 63 65 20 28 6b | 45 72 72 53 74 72 69 6e |ource (k|ErrStrin|
|000050e0| 67 54 79 70 65 2c 20 6b | 49 6e 74 65 72 6e 61 6c |gType, k|Internal|
|000050f0| 45 72 72 6f 72 29 3b 0d | 09 4e 75 6d 54 6f 53 74 |Error);.|.NumToSt|
|00005100| 72 69 6e 67 20 28 6d 61 | 63 45 72 72 2c 20 65 72 |ring (ma|cErr, er|
|00005110| 72 4e 75 6d 29 3b 0d 09 | 48 4c 6f 63 6b 20 28 28 |rNum);..|HLock ((|
|00005120| 48 61 6e 64 6c 65 29 20 | 65 72 72 4d 73 67 29 3b |Handle) |errMsg);|
|00005130| 0d 09 50 61 72 61 6d 54 | 65 78 74 20 28 2a 65 72 |..ParamT|ext (*er|
|00005140| 72 4d 73 67 2c 20 65 72 | 72 4e 75 6d 2c 20 4e 55 |rMsg, er|rNum, NU|
|00005150| 4c 4c 2c 20 4e 55 4c 4c | 29 3b 0d 09 49 6e 69 74 |LL, NULL|);..Init|
|00005160| 43 75 72 73 6f 72 20 28 | 29 3b 0d 09 69 74 65 6d |Cursor (|);..item|
|00005170| 48 69 74 20 3d 20 53 74 | 6f 70 41 6c 65 72 74 20 |Hit = St|opAlert |
|00005180| 28 6b 45 72 72 6f 72 41 | 6c 65 72 74 52 65 73 49 |(kErrorA|lertResI|
|00005190| 44 2c 20 4e 55 4c 4c 29 | 3b 0d 09 48 55 6e 6c 6f |D, NULL)|;..HUnlo|
|000051a0| 63 6b 20 28 28 48 61 6e | 64 6c 65 29 20 65 72 72 |ck ((Han|dle) err|
|000051b0| 4d 73 67 29 3b 0d 09 52 | 65 6c 65 61 73 65 52 65 |Msg);..R|eleaseRe|
|000051c0| 73 6f 75 72 63 65 20 28 | 28 48 61 6e 64 6c 65 29 |source (|(Handle)|
|000051d0| 20 65 72 72 4d 73 67 29 | 3b 0d 7d 0d 0d 0d 2f 2a | errMsg)|;.}.../*|
|000051e0| 09 44 69 73 61 62 6c 65 | 53 74 6f 63 6b 50 61 74 |.Disable|StockPat|
|000051f0| 68 0d 09 64 69 73 61 62 | 6c 65 20 74 68 65 20 73 |h..disab|le the s|
|00005200| 74 6f 63 6b 50 61 74 68 | 20 70 61 72 74 20 6f 66 |tockPath| part of|
|00005210| 20 74 68 65 20 67 54 6f | 70 4c 61 6e 67 75 61 67 | the gTo|pLanguag|
|00005220| 65 4d 6f 64 65 6c 20 62 | 75 69 6c 74 20 69 6e 20 |eModel b|uilt in |
|00005230| 41 64 64 46 61 6e 63 69 | 65 72 4c 61 6e 67 75 61 |AddFanci|erLangua|
|00005240| 67 65 4d 6f 64 65 6c 2e | 0d 2a 2f 0d 0d 4f 53 45 |geModel.|.*/..OSE|
|00005250| 72 72 20 44 69 73 61 62 | 6c 65 53 74 6f 63 6b 50 |rr Disab|leStockP|
|00005260| 61 74 68 20 28 29 0d 7b | 0d 09 2f 2a 20 54 68 65 |ath ().{|../* The|
|00005270| 20 73 74 6f 63 6b 20 70 | 61 74 68 20 69 73 20 74 | stock p|ath is t|
|00005280| 68 65 20 34 74 68 20 69 | 74 65 6d 20 69 6e 20 74 |he 4th i|tem in t|
|00005290| 68 69 73 20 4c 4d 20 2a | 2f 0d 09 53 52 50 61 74 |his LM *|/..SRPat|
|000052a0| 68 20 09 73 74 6f 63 6b | 50 61 74 68 3b 0d 09 4f |h .stock|Path;..O|
|000052b0| 53 45 72 72 20 73 74 61 | 74 75 73 20 3d 20 53 52 |SErr sta|tus = SR|
|000052c0| 47 65 74 49 6e 64 65 78 | 65 64 49 74 65 6d 20 28 |GetIndex|edItem (|
|000052d0| 67 54 6f 70 4c 61 6e 67 | 75 61 67 65 4d 6f 64 65 |gTopLang|uageMode|
|000052e0| 6c 2c 20 26 73 74 6f 63 | 6b 50 61 74 68 2c 20 33 |l, &stoc|kPath, 3|
|000052f0| 29 3b 0d 0d 09 69 66 20 | 28 21 73 74 61 74 75 73 |);...if |(!status|
|00005300| 29 20 7b 0d 09 09 42 6f | 6f 6c 65 61 6e 20 65 6e |) {...Bo|olean en|
|00005310| 61 62 6c 65 64 20 3d 20 | 66 61 6c 73 65 3b 0d 0d |abled = |false;..|
|00005320| 09 09 73 74 61 74 75 73 | 20 3d 20 53 52 53 65 74 |..status| = SRSet|
|00005330| 50 72 6f 70 65 72 74 79 | 20 28 73 74 6f 63 6b 50 |Property| (stockP|
|00005340| 61 74 68 2c 20 6b 53 52 | 45 6e 61 62 6c 65 64 2c |ath, kSR|Enabled,|
|00005350| 20 26 65 6e 61 62 6c 65 | 64 2c 20 73 69 7a 65 6f | &enable|d, sizeo|
|00005360| 66 20 28 65 6e 61 62 6c | 65 64 29 29 3b 0d 09 09 |f (enabl|ed));...|
|00005370| 0d 09 09 53 52 52 65 6c | 65 61 73 65 4f 62 6a 65 |...SRRel|easeObje|
|00005380| 63 74 20 28 73 74 6f 63 | 6b 50 61 74 68 29 3b 09 |ct (stoc|kPath);.|
|00005390| 09 2f 2a 20 69 67 6e 6f | 72 65 20 73 74 61 74 75 |./* igno|re statu|
|000053a0| 73 20 2a 2f 0d 09 7d 0d | 09 0d 09 72 65 74 75 72 |s */..}.|...retur|
|000053b0| 6e 20 73 74 61 74 75 73 | 3b 0d 7d 0d 0d 2f 2a 0d |n status|;.}../*.|
|000053c0| 09 52 65 66 69 6c 6c 43 | 6f 6d 70 61 6e 79 4c 4d |.RefillC|ompanyLM|
|000053d0| 0d 09 0d 09 52 65 70 6c | 61 63 65 20 74 68 65 20 |....Repl|ace the |
|000053e0| 63 6f 6e 74 65 6e 74 73 | 20 6f 66 20 74 68 65 20 |contents| of the |
|000053f0| 3c 63 6f 6d 70 61 6e 79 | 3e 20 6c 61 6e 67 75 61 |<company|> langua|
|00005400| 67 65 20 6d 6f 64 65 6c | 20 77 69 74 68 20 64 69 |ge model| with di|
|00005410| 66 66 65 72 65 6e 74 20 | 63 6f 6d 70 61 6e 79 20 |fferent |company |
|00005420| 6e 61 6d 65 73 2e 09 0d | 2a 2f 0d 0d 4f 53 45 72 |names...|*/..OSEr|
|00005430| 72 20 52 65 66 69 6c 6c | 43 6f 6d 70 61 6e 79 4c |r Refill|CompanyL|
|00005440| 4d 20 28 29 0d 7b 0d 09 | 2f 2a 20 54 68 65 20 73 |M ().{..|/* The s|
|00005450| 74 6f 63 6b 20 70 61 74 | 68 20 69 73 20 74 68 65 |tock pat|h is the|
|00005460| 20 34 74 68 20 69 74 65 | 6d 20 69 6e 20 74 68 69 | 4th ite|m in thi|
|00005470| 73 20 4c 4d 20 2a 2f 0d | 09 53 52 50 61 74 68 20 |s LM */.|.SRPath |
|00005480| 09 73 74 6f 63 6b 50 61 | 74 68 3b 0d 09 4f 53 45 |.stockPa|th;..OSE|
|00005490| 72 72 20 73 74 61 74 75 | 73 20 3d 20 53 52 47 65 |rr statu|s = SRGe|
|000054a0| 74 49 6e 64 65 78 65 64 | 49 74 65 6d 20 28 67 54 |tIndexed|Item (gT|
|000054b0| 6f 70 4c 61 6e 67 75 61 | 67 65 4d 6f 64 65 6c 2c |opLangua|geModel,|
|000054c0| 20 26 73 74 6f 63 6b 50 | 61 74 68 2c 20 33 29 3b | &stockP|ath, 3);|
|000054d0| 0d 0d 09 69 66 20 28 21 | 73 74 61 74 75 73 29 20 |...if (!|status) |
|000054e0| 7b 0d 09 09 2f 2a 20 65 | 6d 70 74 79 20 26 20 72 |{.../* e|mpty & r|
|000054f0| 65 66 69 6c 6c 20 74 68 | 65 20 65 6d 62 65 64 64 |efill th|e embedd|
|00005500| 65 64 20 3c 63 6f 6d 70 | 61 6e 79 3e 20 6c 61 6e |ed <comp|any> lan|
|00005510| 67 75 61 67 65 20 6d 6f | 64 65 6c 2e 20 2a 2f 0d |guage mo|del. */.|
|00005520| 09 09 2f 2a 20 74 68 65 | 20 63 6f 6d 70 61 6e 79 |../* the| company|
|00005530| 4c 4d 20 69 73 20 74 68 | 65 20 73 65 63 6f 6e 64 |LM is th|e second|
|00005540| 20 69 74 65 6d 20 69 6e | 20 74 68 65 20 73 74 6f | item in| the sto|
|00005550| 63 6b 50 61 74 68 20 2a | 2f 0d 09 09 53 52 4c 61 |ckPath *|/...SRLa|
|00005560| 6e 67 75 61 67 65 4d 6f | 64 65 6c 20 63 6f 6d 70 |nguageMo|del comp|
|00005570| 61 6e 79 4c 4d 3b 0d 09 | 09 4f 53 45 72 72 20 73 |anyLM;..|.OSErr s|
|00005580| 74 61 74 75 73 20 3d 20 | 53 52 47 65 74 49 6e 64 |tatus = |SRGetInd|
|00005590| 65 78 65 64 49 74 65 6d | 20 28 73 74 6f 63 6b 50 |exedItem| (stockP|
|000055a0| 61 74 68 2c 20 26 63 6f | 6d 70 61 6e 79 4c 4d 2c |ath, &co|mpanyLM,|
|000055b0| 20 31 29 3b 0d 0d 09 09 | 69 66 20 28 21 73 74 61 | 1);....|if (!sta|
|000055c0| 74 75 73 29 20 7b 0d 09 | 09 09 2f 2a 20 74 68 69 |tus) {..|../* thi|
|000055d0| 73 20 72 65 6c 65 61 73 | 65 73 20 65 61 63 68 20 |s releas|es each |
|000055e0| 70 68 72 61 73 65 20 69 | 6e 20 74 68 65 20 63 6f |phrase i|n the co|
|000055f0| 6d 70 61 6e 79 20 6c 61 | 6e 67 75 61 67 65 20 6d |mpany la|nguage m|
|00005600| 6f 64 65 6c 20 2a 2f 0d | 09 09 09 73 74 61 74 75 |odel */.|...statu|
|00005610| 73 20 3d 20 53 52 45 6d | 70 74 79 4c 61 6e 67 75 |s = SREm|ptyLangu|
|00005620| 61 67 65 4f 62 6a 65 63 | 74 20 28 63 6f 6d 70 61 |ageObjec|t (compa|
|00005630| 6e 79 4c 4d 29 3b 0d 0d | 09 09 09 2f 2a 20 6e 6f |nyLM);..|.../* no|
|00005640| 77 20 72 65 62 75 69 6c | 64 20 74 68 65 20 63 6f |w rebuil|d the co|
|00005650| 6d 70 61 6e 79 20 6c 61 | 6e 67 75 61 67 65 20 6d |mpany la|nguage m|
|00005660| 6f 64 65 6c 20 77 69 74 | 68 20 6e 65 77 20 63 6f |odel wit|h new co|
|00005670| 6d 70 61 6e 69 65 73 20 | 2a 2f 0d 09 09 09 69 66 |mpanies |*/....if|
|00005680| 20 28 21 73 74 61 74 75 | 73 29 20 7b 0d 09 09 09 | (!statu|s) {....|
|00005690| 09 63 6f 6e 73 74 20 63 | 68 61 72 09 2a 6b 4e 65 |.const c|har.*kNe|
|000056a0| 77 43 6f 6d 70 61 6e 69 | 65 73 5b 5d 09 3d 20 7b |wCompani|es[].= {|
|000056b0| 09 22 49 20 42 20 4d 22 | 2c 20 22 4d 6f 74 6f 72 |."I B M"|, "Motor|
|000056c0| 6f 6c 61 22 2c 20 22 43 | 6f 63 61 20 43 6f 6c 61 |ola", "C|oca Cola|
|000056d0| 22 2c 20 4e 55 4c 4c 20 | 7d 3b 0d 09 09 09 09 63 |", NULL |};.....c|
|000056e0| 68 61 72 20 09 09 2a 2a | 63 6f 6d 70 61 6e 79 09 |har ..**|company.|
|000056f0| 09 09 3d 20 28 63 68 61 | 72 20 2a 2a 29 20 6b 4e |..= (cha|r **) kN|
|00005700| 65 77 43 6f 6d 70 61 6e | 69 65 73 3b 0d 09 09 09 |ewCompan|ies;....|
|00005710| 09 6c 6f 6e 67 09 09 72 | 65 66 63 6f 6e 09 09 09 |.long..r|efcon...|
|00005720| 09 3d 20 30 3b 0d 0d 09 | 09 09 09 77 68 69 6c 65 |.= 0;...|...while|
|00005730| 20 28 2a 63 6f 6d 70 61 | 6e 79 20 26 26 20 21 73 | (*compa|ny && !s|
|00005740| 74 61 74 75 73 29 20 7b | 0d 09 09 09 09 09 73 74 |tatus) {|......st|
|00005750| 61 74 75 73 20 3d 20 53 | 52 41 64 64 54 65 78 74 |atus = S|RAddText|
|00005760| 20 28 63 6f 6d 70 61 6e | 79 4c 4d 2c 20 2a 63 6f | (compan|yLM, *co|
|00005770| 6d 70 61 6e 79 2c 20 73 | 74 72 6c 65 6e 20 28 2a |mpany, s|trlen (*|
|00005780| 63 6f 6d 70 61 6e 79 29 | 2c 20 72 65 66 63 6f 6e |company)|, refcon|
|00005790| 2b 2b 29 3b 0d 09 09 09 | 09 09 2b 2b 63 6f 6d 70 |++);....|..++comp|
|000057a0| 61 6e 79 3b 0d 09 09 09 | 09 7d 0d 09 09 09 7d 0d |any;....|.}....}.|
|000057b0| 09 09 7d 0d 09 09 73 74 | 61 74 75 73 20 3d 20 53 |..}...st|atus = S|
|000057c0| 52 52 65 6c 65 61 73 65 | 4f 62 6a 65 63 74 20 28 |RRelease|Object (|
|000057d0| 73 74 6f 63 6b 50 61 74 | 68 29 3b 09 09 2f 2a 20 |stockPat|h);../* |
|000057e0| 53 52 52 65 6c 65 61 73 | 65 c9 20 77 68 61 74 20 |SRReleas|e. what |
|000057f0| 77 65 20 53 52 47 6f 74 | c9 20 2a 2f 0d 09 7d 0d |we SRGot|. */..}.|
|00005800| 09 0d 09 72 65 74 75 72 | 6e 20 73 74 61 74 75 73 |...retur|n status|
|00005810| 3b 0d 7d 0d 0d 2f 2a 09 | 53 61 76 65 54 6f 70 4c |;.}../*.|SaveTopL|
|00005820| 61 6e 67 75 61 67 65 4d | 6f 64 65 6c 0d 09 0d 09 |anguageM|odel....|
|00005830| 53 61 76 65 20 74 68 65 | 20 67 54 6f 70 4c 61 6e |Save the| gTopLan|
|00005840| 67 75 61 67 65 4d 6f 64 | 65 6c 20 74 6f 20 74 68 |guageMod|el to th|
|00005850| 65 20 63 75 72 72 65 6e | 74 20 72 65 73 6f 75 72 |e curren|t resour|
|00005860| 63 65 20 66 69 6c 65 2e | 20 20 4e 6f 74 65 20 74 |ce file.| Note t|
|00005870| 68 61 74 0d 09 69 6e 20 | 74 68 69 73 20 63 61 73 |hat..in |this cas|
|00005880| 65 20 74 68 61 74 27 73 | 20 74 68 65 20 72 65 73 |e that's| the res|
|00005890| 6f 75 72 63 65 20 66 6f | 72 6b 20 6f 66 20 74 68 |ource fo|rk of th|
|000058a0| 69 73 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 61 |is appli|cation a|
|000058b0| 6e 64 20 69 73 0d 09 74 | 68 65 72 65 66 6f 72 65 |nd is..t|herefore|
|000058c0| 20 75 6e 61 64 76 69 73 | 61 62 6c 65 20 62 65 68 | unadvis|able beh|
|000058d0| 61 76 69 6f 72 2e 0d 2a | 2f 0d 0d 4f 53 45 72 72 |avior..*|/..OSErr|
|000058e0| 20 53 61 76 65 54 6f 70 | 4c 61 6e 67 75 61 67 65 | SaveTop|Language|
|000058f0| 4d 6f 64 65 6c 20 28 29 | 0d 7b 0d 09 2f 2a 20 61 |Model ()|.{../* a|
|00005900| 6c 6c 6f 63 61 74 65 20 | 61 20 48 61 6e 64 6c 65 |llocate |a Handle|
|00005910| 20 6f 66 20 73 69 7a 65 | 20 30 20 74 6f 20 73 74 | of size| 0 to st|
|00005920| 6f 72 65 20 6f 75 72 20 | 6c 61 6e 67 75 61 67 65 |ore our |language|
|00005930| 20 6d 6f 64 65 6c 20 69 | 6e 3b 20 2a 2f 0d 09 2f | model i|n; */../|
|00005940| 2a 20 53 52 50 75 74 4c | 61 6e 67 75 61 67 65 4f |* SRPutL|anguageO|
|00005950| 62 6a 65 63 74 49 6e 74 | 6f 48 61 6e 64 6c 65 20 |bjectInt|oHandle |
|00005960| 77 69 6c 6c 20 72 65 73 | 69 7a 65 20 69 74 20 61 |will res|ize it a|
|00005970| 73 20 6e 65 65 64 65 64 | 20 2a 2f 0d 09 48 61 6e |s needed| */..Han|
|00005980| 64 6c 65 09 6c 6d 48 61 | 6e 64 6c 65 09 3d 20 4e |dle.lmHa|ndle.= N|
|00005990| 65 77 48 61 6e 64 6c 65 | 20 28 30 29 3b 0d 09 4f |ewHandle| (0);..O|
|000059a0| 53 45 72 72 09 73 74 61 | 74 75 73 09 09 3d 20 4d |SErr.sta|tus..= M|
|000059b0| 65 6d 45 72 72 6f 72 20 | 28 29 3b 0d 0d 09 69 66 |emError |();...if|
|000059c0| 20 28 21 73 74 61 74 75 | 73 29 20 7b 0d 09 09 73 | (!statu|s) {...s|
|000059d0| 74 61 74 75 73 20 3d 20 | 53 52 50 75 74 4c 61 6e |tatus = |SRPutLan|
|000059e0| 67 75 61 67 65 4f 62 6a | 65 63 74 49 6e 74 6f 48 |guageObj|ectIntoH|
|000059f0| 61 6e 64 6c 65 20 28 67 | 54 6f 70 4c 61 6e 67 75 |andle (g|TopLangu|
|00005a00| 61 67 65 4d 6f 64 65 6c | 2c 20 6c 6d 48 61 6e 64 |ageModel|, lmHand|
|00005a10| 6c 65 29 3b 0d 09 09 0d | 09 09 69 66 20 28 21 73 |le);....|..if (!s|
|00005a20| 74 61 74 75 73 29 20 7b | 0d 09 09 09 2f 2a 20 73 |tatus) {|..../* s|
|00005a30| 61 76 65 20 74 68 65 20 | 6c 61 6e 67 75 61 67 65 |ave the |language|
|00005a40| 20 6d 6f 64 65 6c 20 61 | 73 20 61 20 72 65 73 6f | model a|s a reso|
|00005a50| 75 72 63 65 20 69 6e 20 | 74 68 65 20 63 75 72 72 |urce in |the curr|
|00005a60| 65 6e 74 20 2a 2f 0d 09 | 09 09 2f 2a 20 72 65 73 |ent */..|../* res|
|00005a70| 6f 75 72 63 65 20 66 69 | 6c 65 2e 20 50 69 63 6b |ource fi|le. Pick|
|00005a80| 20 61 20 72 65 61 73 6f | 6e 61 62 6c 65 20 72 65 | a reaso|nable re|
|00005a90| 73 6f 75 72 63 65 20 74 | 79 70 65 20 26 20 49 44 |source t|ype & ID|
|00005aa0| 20 2a 2f 0d 09 09 09 41 | 64 64 52 65 73 6f 75 72 | */....A|ddResour|
|00005ab0| 63 65 20 28 6c 6d 48 61 | 6e 64 6c 65 2c 20 27 4c |ce (lmHa|ndle, 'L|
|00005ac0| 4d 44 4c 27 2c 20 31 30 | 30 2c 20 22 5c 70 54 6f |MDL', 10|0, "\pTo|
|00005ad0| 70 20 4c 61 6e 67 75 61 | 67 65 20 4d 6f 64 65 6c |p Langua|ge Model|
|00005ae0| 22 29 3b 0d 0d 09 09 09 | 2f 2a 20 6d 61 6b 65 20 |");.....|/* make |
|00005af0| 73 75 72 65 20 69 74 20 | 67 65 74 73 20 77 72 69 |sure it |gets wri|
|00005b00| 74 74 65 6e 20 74 6f 20 | 64 69 73 6b 20 2a 2f 0d |tten to |disk */.|
|00005b10| 09 09 09 69 66 20 28 21 | 28 73 74 61 74 75 73 20 |...if (!|(status |
|00005b20| 3d 20 52 65 73 45 72 72 | 6f 72 20 28 29 29 29 0d |= ResErr|or ())).|
|00005b30| 09 09 09 09 57 72 69 74 | 65 52 65 73 6f 75 72 63 |....Writ|eResourc|
|00005b40| 65 20 28 6c 6d 48 61 6e | 64 6c 65 29 3b 0d 09 09 |e (lmHan|dle);...|
|00005b50| 7d 0d 09 09 0d 09 09 44 | 69 73 70 6f 73 65 48 61 |}......D|isposeHa|
|00005b60| 6e 64 6c 65 20 28 6c 6d | 48 61 6e 64 6c 65 29 3b |ndle (lm|Handle);|
|00005b70| 0d 09 7d 0d 09 0d 09 72 | 65 74 75 72 6e 20 73 74 |..}....r|eturn st|
|00005b80| 61 74 75 73 3b 0d 7d 0d | 0d 0d 00 00 00 00 00 00 |atus;.}.|........|
|00005b90| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005ba0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bb0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005be0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005bf0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c00| 00 00 01 00 00 00 01 76 | 00 00 00 76 00 00 00 52 |.......v|...v...R|
|00005c10| 00 00 2f 0c 28 6e 00 08 | 2f 2e 00 10 2f 2e 00 14 |../.(n..|/.../...|
|00005c20| 20 54 48 68 00 02 4e ad | 0e 6a 2f 2e 00 1c 2f 2e | THh..N.|.j/.../.|
|00005c30| 0a 53 52 53 61 6d 70 6c | 65 2e 63 6d 02 00 00 00 |.SRSampl|e.cm....|
|00005c40| 54 45 58 54 43 57 49 45 | 01 00 00 34 00 40 00 00 |TEXTCWIE|...4.@..|
|00005c50| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 34 00 40 |..TEXTCW|IE...4.@|
|00005c60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005c70| 00 00 ab fc e5 7c 00 00 | 5b 0a 00 00 01 c8 2f 2e |.....|..|[...../.|
|00005c80| 00 10 2f 0b 3f 10 2f 28 | 00 28 4e ad 0e 92 3e 1f |../.?./(|.(N...>.|
|00005c90| 58 8f 66 2e 55 8f 3f 2e | 00 0e 20 54 48 68 00 02 |X.f.U.?.|.. THh..|
|00005ca0| 2f 2e 00 14 3f 3c 01 00 | 2f 2e 00 10 70 26 3f 00 |/...?<..|/...p&?.|
|00005cb0| 48 6e ff fe 2f 0b 3f 10 | 2f 28 00 28 4e ad 0e 8a |Hn../.?.|/(.(N...|
|00005cc0| 3e 1f 2f 0c 4e ba 00 6c | 30 07 58 8f 4c ee 18 80 |>./.N..l|0.X.L...|
|00005cd0| ff e2 4e 5e 4e 75 4e 56 | 00 00 2f 0c 28 6e 00 08 |..N^NuNV|../.(n..|
|00005ce0| 55 8f 20 54 3f 10 2f 28 | 00 28 4e ad 0e aa 30 1f |U. T?./(|.(N...0.|
|00005cf0| 28 6e ff fc 4e 5e 4e 75 | 4e 56 00 00 55 8f 20 6e |(n..N^Nu|NV..U. n|
|00005d00| 00 00 00 1e 00 57 01 28 | 03 48 04 46 00 57 01 28 |.....W.(|.H.F.W.(|
|00005d10| 03 48 04 46 00 00 17 a0 | 00 00 00 00 00 00 00 00 |.H.F....|........|
|00005d20| 00 00 00 00 00 48 00 09 | 4d 6f 6e 61 63 6f 00 00 |.....H..|Monaco..|
|00005d30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005d40| 00 00 00 00 00 00 00 00 | 00 03 00 04 00 40 00 04 |........|.....@..|
|00005d50| 02 ed 02 63 00 40 00 04 | 02 ed 02 63 ad ed 89 88 |...c.@..|...c....|
|00005d60| 00 00 21 d4 00 00 21 d4 | 00 00 1b a8 01 00 00 00 |..!...!.|........|
|00005d70| 00 04 00 01 00 01 00 00 | 01 00 00 00 01 76 00 00 |........|.....v..|
|00005d80| 00 76 00 00 00 52 01 1d | 2e 5c 2e 46 00 00 00 1c |.v...R..|.\.F....|
|00005d90| 00 52 00 01 4d 50 53 52 | 00 01 00 12 4d 57 42 42 |.R..MPSR|....MWBB|
|00005da0| 00 00 00 2a 03 f0 ff ff | 00 00 00 00 00 00 00 00 |...*....|........|
|00005db0| 03 ed ff ff 00 00 00 22 | 00 00 00 00 03 f0 ff ff |......."|........|
|00005dc0| 00 00 00 6e 00 00 00 00 | 00 00 00 00 00 00 00 00 |...n....|........|
|00005dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00005df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+